@@ -10,35 +10,96 @@ jobs:
1010 context :
1111 runs-on : ubuntu-latest
1212
13+ outputs :
14+ emoji : ${{ steps.ref.outputs.emoji }}
15+ actor : ${{ steps.ref.outputs.actor }}
16+ event : ${{ steps.ref.outputs.event }}
17+ env : ${{ steps.ref.outputs.env }}
18+ conclusion : ${{ steps.ref.outputs.conclusion }}
19+ ref : ${{ steps.ref.outputs.ref }}
20+ ref_link : ${{ steps.ref.outputs.ref_link }}
21+ workflow_id : ${{ steps.ref.outputs.workflow_id }}
22+ workflow_url : ${{ steps.ref.outputs.workflow_url }}
23+
1324 steps :
1425 - uses : actions/checkout@v4
1526 - uses : ./.github/actions/context
27+ - id : ref
28+ shell : bash
29+ run : |
30+ branch="${{ github.event.workflow_run.head_branch }}"
31+ title="${{ github.event.workflow_run.display_title }}"
32+ sha="${{ github.event.workflow_run.head_sha }}"
33+ html_url="${{ github.event.workflow_run.html_url}}"
34+ actor="${{ github.event.workflow_run.triggering_actor.login }}"
35+ conclusion="${{ github.event.workflow_run.conclusion }}"
36+
37+ commit_short=$(echo "$sha" | cut -c1-7)
38+
39+ ref="$branch ($commit_short) $title"
40+ event="${{ github.event.workflow_run.event}}"
41+ repo_url="${{ github.server_url }}/${{ github.repository }}"
42+
43+ if [[ "$event" == "push" ]]; then
44+ env="dev"
45+ ref_link="$repo_url/commit/$commit_long"
46+ elif [[ "$event" == "release" ]]; then
47+ env="production"
48+ ref_link="$repo_url/releases/tag/$head_branch"
49+ fi
50+
51+ if [[ "$conclusion" == "success" ]]; then
52+ emoji=":white_check_mark:"
53+ else
54+ emoji=":x:"
55+ fi
56+
57+ echo "emoji=$emoji" >> $GITHUB_OUTPUT
58+ echo "actor=$actor" >> $GITHUB_OUTPUT
59+ echo "event=$event" >> $GITHUB_OUTPUT
60+ echo "conclusion=$conclusion" >> $GITHUB_OUTPUT
61+ echo "env=$env" >> $GITHUB_OUTPUT
62+ echo "ref=$ref" >> $GITHUB_OUTPUT
63+ echo "ref_link=$ref_link" >> $GITHUB_OUTPUT
64+ echo "workflow_id=$workflow_id" >> $GITHUB_OUTPUT
65+ echo "workflow_url=$workflow_url" >> $GITHUB_OUTPUT
66+ cat $GITHUB_OUTPUT
1667
1768 slack_notification :
1869 needs : context
1970 strategy :
2071 matrix :
2172 include :
22- - actor : ${{ github.event.workflow_run.actor.login }}
23- event : ' push'
24- conclusion : ' success'
25- env : ' dev'
26- ref : ${{ github.event.workflow_run.head_commit.id }}
27- - actor : ${{ github.event.workflow_run.actor.login }}
73+ # The real message based on the context of the workflow
74+ - emoji : ${{ needs.context.outputs.emoji }}
75+ actor : ${{ needs.context.outputs.actor }}
76+ event : ${{ needs.context.outputs.event }}
77+ conclusion : ${{ needs.context.outputs.conclusion }}
78+ env : ${{ needs.context.outputs.env }}
79+ ref : ${{ needs.context.outputs.ref }}
80+ ref_link : ${{ needs.context.outputs.ref_link }}
81+ workflow_id : ${{ github.event.workflow_run.id }}
82+ workflow_url : ${{ github.event.workflow_run.html_url }}
83+ # No Emoji
84+ - emoji : ' '
85+ actor : ${{ needs.context.outputs.actor }}
86+ event : ${{ needs.context.outputs.event }}
87+ conclusion : ${{ needs.context.outputs.conclusion }}
88+ env : ${{ needs.context.outputs.env }}
89+ ref : ${{ needs.context.outputs.ref }}
90+ ref_link : ${{ needs.context.outputs.ref_link }}
91+ workflow_id : ${{ github.event.workflow_run.id }}
92+ workflow_url : ${{ github.event.workflow_run.html_url }}
93+ # Custom Emoji and ref
94+ - emoji : ' :party_blob:'
95+ actor : ${{ github.event.workflow_run.actor.login }}
2896 event : ' push'
2997 conclusion : ' failure'
3098 env : ' dev'
31- ref : ${{ github.event.workflow_run.head_commit.id }}
32- - actor : ${{ github.event.workflow_run.actor.login }}
33- event : ' release'
34- conclusion : ' success'
35- env : ' production'
36- ref : 2025.01.01
37- - actor : ${{ github.event.workflow_run.actor.login }}
38- event : ' release'
39- conclusion : ' failure'
40- env : ' production'
41- ref : 2025.01.01
99+ ref : ' It is time to party!'
100+ ref_link : ${{ needs.context.outputs.ref_link }}
101+ workflow_id : ${{ github.event.workflow_run.id }}
102+ workflow_url : ${{ github.event.workflow_run.html_url }}
42103
43104 runs-on : ubuntu-latest
44105 steps :
0 commit comments