Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 859abcd

Browse files
authored
chore: send notification to #dev on any CI failure on main (#16102)
We've had a [few failures in main](https://github.com/coder/coder/actions?query=branch%3Amain+is%3Afailure) of late, and unless the committer of the change has CI notifications enabled we may not be aware of the failure. This PR sends a Slack notification to the #dev channel so everyone has visibility. Signed-off-by: Danny Kopping <[email protected]>
1 parent 88a9c4b commit 859abcd

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/ci.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -1248,3 +1248,52 @@ jobs:
12481248
- name: Setup and run sqlc vet
12491249
run: |
12501250
make sqlc-vet
1251+
1252+
notify-slack-on-failure:
1253+
runs-on: ubuntu-latest
1254+
if: always() && failure() && github.ref == 'refs/heads/main'
1255+
1256+
steps:
1257+
- name: Send Slack notification
1258+
run: |
1259+
curl -X POST -H 'Content-type: application/json' \
1260+
--data '{
1261+
"blocks": [
1262+
{
1263+
"type": "header",
1264+
"text": {
1265+
"type": "plain_text",
1266+
"text": "❌ CI Failure in `main`",
1267+
"emoji": true
1268+
}
1269+
},
1270+
{
1271+
"type": "section",
1272+
"fields": [
1273+
{
1274+
"type": "mrkdwn",
1275+
"text": "*Workflow:*\n${{ github.workflow }}"
1276+
},
1277+
{
1278+
"type": "mrkdwn",
1279+
"text": "*Failed Job:*\n${{ github.job }}"
1280+
},
1281+
{
1282+
"type": "mrkdwn",
1283+
"text": "*Committer:*\n${{ github.actor }}"
1284+
},
1285+
{
1286+
"type": "mrkdwn",
1287+
"text": "*Commit:*\n${{ github.sha }}"
1288+
}
1289+
]
1290+
},
1291+
{
1292+
"type": "section",
1293+
"text": {
1294+
"type": "mrkdwn",
1295+
"text": "*View failure:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Click here>"
1296+
}
1297+
}
1298+
]
1299+
}' ${{ secrets.CI_FAILURE_SLACK_WEBHOOK }}

0 commit comments

Comments
 (0)