Skip to content

Commit b437f1e

Browse files
committed
add Slack workflow
1 parent 9867139 commit b437f1e

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

.github/workflows/ci.yml

+5
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,8 @@ jobs:
4040
python-version: '3.12'
4141
- name: file_sync test
4242
run: python ./private/test/file_sync_test.py
43+
slack_test_fail:
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: fail step
47+
run: exit 1

.github/workflows/slack.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# SPDX-License-Identifier: MIT-0
2+
3+
---
4+
name: slack
5+
on:
6+
workflow_run:
7+
workflows: [ci]
8+
types: [completed]
9+
10+
jobs:
11+
notify:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Notify Build Cop Slack
15+
if: github.event.workflow_run.conclusion == 'failure' || github.event.workflow_run.conclusion == 'timed_out'
16+
uses: ravsamhq/notify-slack-action@v2
17+
with:
18+
status: ${{ github.event.workflow_run.conclusion }}
19+
notification_title: >
20+
${{github.event.workflow_run.name}} failed on ${{github.event.workflow_run.head_branch}} -
21+
<${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View Failure>
22+
message_format: |
23+
Result: ${{github.event.workflow_run.conclusion}}
24+
Run: ${{github.event.workflow_run.run_number}}
25+
Branch: <${{github.server_url}}/${{github.repository}}/tree/${{github.event.workflow_run.head_branch}}|${{github.repository}}/${{github.event.workflow_run.head_branch}}>
26+
footer: "Repository: <${{github.server_url}}/${{github.repository}}|${{github.repository}}>"
27+
env:
28+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_BUILDCOP_URL }}

0 commit comments

Comments
 (0)