File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,10 +14,10 @@ inputs:
1414outputs :
1515 channel_id :
1616 description : Slack channel id for the posted message.
17- value : ${{ steps.post .outputs.channel_id }}
17+ value : ${{ steps.extract .outputs.channel_id }}
1818 ts :
1919 description : Slack message timestamp for updates.
20- value : ${{ steps.post .outputs.ts }}
20+ value : ${{ steps.extract .outputs.ts }}
2121
2222runs :
2323 using : composite
3838 attachments:
3939 - color: "${{ inputs.running_color }}"
4040 text: "${{ inputs.message_prefix }}: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}> started at ${{ steps.start-time.outputs.value }}"
41+
42+ - name : Extract message identifiers
43+ id : extract
44+ shell : bash
45+ env :
46+ SLACK_RESPONSE : ${{ steps.post.outputs.response }}
47+ SLACK_TS : ${{ steps.post.outputs.ts }}
48+ SLACK_CHANNEL_ID : ${{ steps.post.outputs.channel_id }}
49+ run : |
50+ ts="$SLACK_TS"
51+ channel_id="$SLACK_CHANNEL_ID"
52+
53+ if [[ -n "$SLACK_RESPONSE" && "$SLACK_RESPONSE" != "null" ]]; then
54+ if [[ -z "$ts" ]]; then
55+ ts=$(echo "$SLACK_RESPONSE" | jq -r '.ts // empty')
56+ fi
57+ if [[ -z "$channel_id" ]]; then
58+ channel_id=$(echo "$SLACK_RESPONSE" | jq -r '.channel_id // .channel // empty')
59+ fi
60+ fi
61+
62+ echo "ts=$ts" >> "$GITHUB_OUTPUT"
63+ echo "channel_id=$channel_id" >> "$GITHUB_OUTPUT"
Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ jobs:
133133 uk.co.bbc.bug.build.commit=${{ github.sha }}
134134
135135 - name : update slack message
136- if : ${{ always() && steps.slack-start.outputs.ts != '' }}
136+ if : ${{ always() && steps.slack-start.outputs.ts != '' && steps.slack-start.outputs.channel_id != '' }}
137137 uses : ./.github/actions/slack-run-finish
138138 with :
139139 channel_id : ${{ steps.slack-start.outputs.channel_id }}
Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ jobs:
143143
144144 slack-finish :
145145 name : Slack final status
146- if : ${{ always() && needs.slack-start.result == 'success' && needs.slack-start.outputs.ts != '' }}
146+ if : ${{ always() && needs.slack-start.result == 'success' && needs.slack-start.outputs.ts != '' && needs.slack-start.outputs.channel_id != '' }}
147147 needs :
148148 - slack-start
149149 - codespell
Original file line number Diff line number Diff line change 4848 - run : cd src/client && npm run build --if-present
4949
5050 - name : update slack message
51- if : ${{ always() && steps.slack-start.outputs.ts != '' }}
51+ if : ${{ always() && steps.slack-start.outputs.ts != '' && steps.slack-start.outputs.channel_id != '' }}
5252 uses : ./.github/actions/slack-run-finish
5353 with :
5454 channel_id : ${{ steps.slack-start.outputs.channel_id }}
Original file line number Diff line number Diff line change 4949 run : npm run test:server
5050
5151 - name : update slack message
52- if : ${{ always() && steps.slack-start.outputs.ts != '' }}
52+ if : ${{ always() && steps.slack-start.outputs.ts != '' && steps.slack-start.outputs.channel_id != '' }}
5353 uses : ./.github/actions/slack-run-finish
5454 with :
5555 channel_id : ${{ steps.slack-start.outputs.channel_id }}
Original file line number Diff line number Diff line change @@ -219,7 +219,7 @@ jobs:
219219
220220 slack-finish :
221221 name : Slack final status
222- if : ${{ always() && needs.slack-start.result == 'success' && needs.slack-start.outputs.ts != '' }}
222+ if : ${{ always() && needs.slack-start.result == 'success' && needs.slack-start.outputs.ts != '' && needs.slack-start.outputs.channel_id != '' }}
223223 needs :
224224 - slack-start
225225 - discover-modules
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ jobs:
138138
139139 slack-finish :
140140 name : Slack final status
141- if : ${{ always() && needs.slack-start.outputs.ts != '' }}
141+ if : ${{ always() && needs.slack-start.outputs.ts != '' && needs.slack-start.outputs.channel_id != '' }}
142142 needs :
143143 - slack-start
144144 - verify-tests
You can’t perform that action at this time.
0 commit comments