Skip to content

Commit 13ea4aa

Browse files
committed
feat: ci: add on-workflow-end noti
1 parent 70cd6e1 commit 13ea4aa

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Notify Slack on workflow failure
2+
on:
3+
workflow_run:
4+
workflows:
5+
[
6+
Build Go binaries and upload to weave-binaries release,
7+
Go Format and Test,
8+
]
9+
types: [completed]
10+
11+
jobs:
12+
on-failure:
13+
runs-on: ubuntu-latest
14+
if: github.event.workflow_run.conclusion == 'failure' || github.event.workflow_run.conclusion == 'timed_out'
15+
steps:
16+
- uses: ravsamhq/notify-slack-action@v2
17+
with:
18+
status: ${{ github.event.workflow_run.conclusion }}
19+
notification_title: " ${{github.event.workflow_run.name}} - ${{github.event.workflow_run.conclusion}} on ${{github.event.workflow_run.head_branch}} - <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View Failure>"
20+
message_format: ":fire: *${{github.event.workflow_run.name}}* ${{github.event.workflow_run.conclusion}} in <${{github.server_url}}/${{github.repository}}/${{github.event.workflow_run.head_branch}}|${{github.repository}}>"
21+
footer: "Linked Repo <${{github.server_url}}/${{github.repository}}|${{github.repository}}> | <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View Failure>"
22+
env:
23+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
24+
on-success:
25+
runs-on: ubuntu-latest
26+
if: github.event.workflow_run.conclusion == 'success'
27+
steps:
28+
- uses: ravsamhq/notify-slack-action@v2
29+
with:
30+
status: ${{ github.event.workflow_run.conclusion }}
31+
notification_title: " ${{github.event.workflow_run.name}} - ${{github.event.workflow_run.conclusion}} on ${{github.event.workflow_run.head_branch}} - <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View Success>"
32+
message_format: ":white_check_mark: *${{github.event.workflow_run.name}}* ${{github.event.workflow_run.conclusion}} in <${{github.server_url}}/${{github.repository}}/${{github.event.workflow_run.head_branch}}|${{github.repository}}>"
33+
env:
34+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

0 commit comments

Comments
 (0)