Skip to content

Commit 46ba79e

Browse files
authored
Add the workflow failure notification workflow. (#67)
1 parent 1ae1d4d commit 46ba79e

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/notify.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# DO NOT EDIT THIS FILE.
2+
# Instead, edit the jsonpatch file (actually YAML) in .github/notify-patch.yaml
3+
# For docs, see github-actions in the IronCoreLabs/depot repo.
4+
5+
name: Notify
6+
'on':
7+
workflow_run:
8+
workflows:
9+
- Bump Version
10+
- Deploy
11+
- Docker
12+
- Rebuild all container images
13+
- Rust CI
14+
- Rust Daily
15+
- Scala CI
16+
- Scala Daily
17+
- TypeScript CI
18+
- Update Workflows
19+
types:
20+
- completed
21+
branches:
22+
- main
23+
jobs:
24+
on-failure:
25+
runs-on: ubuntu-20.04
26+
if: ${{ github.event.workflow_run.conclusion != 'success' }}
27+
steps:
28+
- name: Debug
29+
run: cat ${{ github.event_path }}
30+
- name: Post to Slack on failure
31+
run: "set -x\necho 'Failed a run of <${{ github.event.workflow_run.html_url\
32+
\ }}|${{ github.event.workflow_run.name }}> in ${{ github.event.repository.name\
33+
\ }}.' > text.txt\necho \"GitHub Workflow Bot\" > username.txt\necho \":bomb:\"\
34+
\ > icon_emoji.txt\n# echo \"https://i.chzbgr.com/full/8209966592/h2FE3826C/how-awesome-are-you\"\
35+
\ > icon_url.txt\necho \"#build-failures\" > channel.txt\necho '{}' | \\\n\
36+
jq --rawfile text text.txt \\\n --rawfile username username.txt \\\n --rawfile\
37+
\ icon_emoji icon_emoji.txt \\\n --rawfile channel channel.txt \\\n '. +\
38+
\ {\"text\": $text, \"username\": $username, \"icon_emoji\": $icon_emoji,\
39+
\ \"channel\": $channel}' | \\\ncurl -Ssf -d @- -H \"Content-type: application/json\"\
40+
\ '${{ secrets.SLACK_BUILD_FAILURE_WEBHOOK }}'\n"

0 commit comments

Comments
 (0)