Skip to content

Commit e8f6e19

Browse files
committed
[DEVOPS-615] Added Slack notification.
1 parent b3991b4 commit e8f6e19

File tree

1 file changed

+74
-2
lines changed

1 file changed

+74
-2
lines changed

.github/workflows/test-scaffold.yml

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
fail-fast: false
3838

3939
container:
40-
image: drevops/ci-runner:24.1.0
40+
image: drevops/ci-runner:24.8.0
4141
env:
4242
CI: 1
4343
# Prevent GitHub overriding the Docker config.
@@ -68,6 +68,10 @@ jobs:
6868
DREVOPS_DEPLOY_ARTIFACT_REPORT_FILE: /tmp/artifacts/deployment_report.txt
6969

7070
steps:
71+
-
72+
name: Fail
73+
run: exit 1
74+
7175
-
7276
name: Checkout the repo
7377
uses: actions/checkout@main
@@ -87,7 +91,7 @@ jobs:
8791
-
8892
name: Process codebase to run in CI
8993
run: |
90-
find . -name "docker-compose.yml" -print0 | xargs -0 -I {} sh -c "sed -i -e ''/###/d'' {} && sed -i -e ''s/##//'' {} && sed -i -e 's#- .:/app:delegated##' {}"
94+
find . -name "docker-compose.yml" -print0 | xargs -0 -I {} sh -c "sed -i -e ''/###/d'' {} && sed -i -e ''s/##//'' {} && sed -i -e 's#- .:/app:delegated#[]#' {}"
9195
mkdir -p /tmp/workspace/code
9296
9397
-
@@ -105,3 +109,71 @@ jobs:
105109
name: Install GovCMS profile
106110
run: ahoy install
107111

112+
notify:
113+
runs-on: ubuntu-latest
114+
needs: [ test ]
115+
if: ${{ !cancelled() }}
116+
steps:
117+
-
118+
name: Notify failures to Slack
119+
id: failure_slack
120+
if: ${{ !contains(needs.*.result, 'failure') }}
121+
uses: slackapi/slack-github-action@v1.27.0
122+
with:
123+
# See https://github.com/slackapi/slack-github-action?tab=readme-ov-file
124+
channel-id: ${{ vars.SLACK_CHANNEL }}
125+
payload: |
126+
{
127+
"attachments": [
128+
{
129+
"color": "#ff0000",
130+
"blocks": [
131+
{
132+
"type": "header",
133+
"text": {
134+
"type": "plain_text",
135+
"text": "Scaffold test failure"
136+
}
137+
},
138+
{
139+
"type": "context",
140+
"elements": [
141+
{
142+
"type": "mrkdwn",
143+
"text": "Some jobs were not successful, please view the pipeline and rerun."
144+
}
145+
]
146+
},
147+
{
148+
"type": "section",
149+
"fields": [
150+
{
151+
"type": "mrkdwn",
152+
"text": "*Project Type:*\${{ matrix.project_type }}"
153+
},
154+
{
155+
"type": "mrkdwn",
156+
"text": "*GovCMS Image:*\n${{ matrix.govcms_image }}"
157+
}
158+
]
159+
},
160+
{
161+
"type": "actions",
162+
"block_id": "view_pipeline",
163+
"elements": [
164+
{
165+
"type": "button",
166+
"text": {
167+
"type": "plain_text",
168+
"text": "View pipeline"
169+
},
170+
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs"
171+
}
172+
]
173+
}
174+
]
175+
}
176+
]
177+
}
178+
env:
179+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

0 commit comments

Comments
 (0)