Skip to content

Commit 10fba23

Browse files
ci: send slack message when ci fails on main
1 parent 407cf62 commit 10fba23

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed

.github/workflows/on-merge.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,24 @@ jobs:
99
test:
1010
uses: ./.github/workflows/test.yaml
1111
secrets: inherit
12+
13+
notify-slack:
14+
needs: test
15+
if: failure()
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Send Slack Notification
19+
uses: slackapi/slack-github-action@v1.26.0
20+
with:
21+
payload: |
22+
{
23+
"text": ":rotating_light: *CI FAILED on main!*",
24+
"attachments": [
25+
{
26+
"color": "danger",
27+
"text": "Workflow: ${{ github.workflow }}\nJob: ${{ github.job }}\nCommit: ${{ github.sha }}\nAuthor: ${{ github.actor }}"
28+
}
29+
]
30+
}
31+
env:
32+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/on-pull-request.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,42 @@ jobs:
1212

1313
check_formatting:
1414
uses: ./.github/workflows/check_formatting.yaml
15+
16+
notify-slack:
17+
needs: test
18+
if: failure()
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Send Slack Notification
22+
uses: slackapi/slack-github-action@v2.1.1
23+
with:
24+
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
25+
webhook-type: incoming-webhook
26+
27+
payload: |
28+
text: "CI failed on ${{ github.ref_name }}" # fallback text
29+
blocks:
30+
- type: "section"
31+
text:
32+
type: "mrkdwn"
33+
text: ":rotating_light: *CI FAILED on `${{ github.ref_name }}`*"
34+
35+
- type: "section"
36+
fields:
37+
- type: "mrkdwn"
38+
text: "*Workflow:*\n`${{ github.workflow }}`"
39+
- type: "mrkdwn"
40+
text: "*Job:*\n`${{ github.job }}`"
41+
- type: "mrkdwn"
42+
text: "*Commit:*\n`${{ github.sha }}`"
43+
- type: "mrkdwn"
44+
text: "*Author:*\n`${{ github.actor }}`"
45+
46+
- type: "actions"
47+
elements:
48+
- type: "button"
49+
text:
50+
type: "plain_text"
51+
text: "View run"
52+
emoji: true
53+
url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"

src/flow_test/test.cairo

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3029,3 +3029,8 @@ fn enable_disable_btc_tokens_flow_test() {
30293029
.span();
30303030
assert!(tokens == expected_tokens);
30313031
}
3032+
3033+
#[test]
3034+
fn test_test() {
3035+
panic!("test");
3036+
}

0 commit comments

Comments
 (0)