Skip to content

Commit 949c99f

Browse files
committed
Test message formatting
1 parent 103b21a commit 949c99f

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

.github/workflows/default_completed.yml

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,39 @@ on:
99
jobs:
1010
context:
1111
runs-on: ubuntu-latest
12-
steps:
13-
- uses: ./.github/actions/context
1412

15-
on-success:
16-
runs-on: ubuntu-latest
17-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
13+
outputs:
14+
is_release_master: true
15+
is_release_tag: true
16+
1817
steps:
19-
- run: echo 'The triggering workflow passed'
20-
on-failure:
18+
- uses: actions/checkout@v4
19+
20+
notify_slack:
2121
runs-on: ubuntu-latest
22-
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
22+
needs: [context]
23+
# Only notify slack on release events
24+
if: ${{ needs.context.outputs.is_release_master || needs.context.outputs.is_release_tag }}
2325
steps:
24-
- run: echo 'The triggering workflow failed'
26+
- name: Notify Slack
27+
uses: mozilla/addons/.github/actions/slack@main
28+
env:
29+
retry_text: '[Rerun Workflow](${{ github.event.workflow_run.rerun_url }})'
30+
event_text: ${{ needs.context.outputs.is_release_master && 'Release Master' || 'Release Tag' }}
31+
with:
32+
slack_token: ${{ secrets.SLACK_TOKEN }}
33+
channel_id: ${{ secrets.SLACK_ADDONS_PRODUCTION_CHANNEL }}
34+
message: >
35+
*Workflow*
36+
event: ${{ env.event_text }}
37+
url: ${{ github.event.workflow_run.url }}
38+
conclusion: ${{ github.event.workflow_run.conclusion }}
39+
40+
*Commit*
41+
sha: ${{ github.event.workflow_run.head_commit.id }}
42+
message: ${{ github.event.workflow_run.head_commit.message }}
43+
author: ${{ github.event.workflow_run.head_commit.author.name }}
44+
date: ${{ github.event.workflow_run.head_commit.timestamp }}
45+
46+
${{ github.event.workflow_run.conclusion == 'failure' && env.retry_text || '' }}
47+

0 commit comments

Comments
 (0)