Skip to content

Commit 12820fa

Browse files
committed
use env slack_channel_id
1 parent 7ec7fb7 commit 12820fa

8 files changed

Lines changed: 8 additions & 37 deletions

File tree

.github/actions/slack-run-finish/action.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ name: Slack Run Finish
22
description: Update a posted workflow Slack message with final status color, or delete it when skipped.
33

44
inputs:
5-
channel_id:
6-
description: Slack channel id returned by start action.
7-
required: true
85
ts:
96
description: Slack message timestamp returned by start action.
107
required: true
@@ -49,7 +46,7 @@ runs:
4946
method: chat.delete
5047
token: ${{ env.SLACK_BOT_TOKEN }}
5148
payload: |
52-
channel: ${{ inputs.channel_id }}
49+
channel: ${{ env.SLACK_CHANNEL_ID }}
5350
ts: ${{ inputs.ts }}
5451
5552
- name: Update message
@@ -59,7 +56,7 @@ runs:
5956
method: chat.update
6057
token: ${{ env.SLACK_BOT_TOKEN }}
6158
payload: |
62-
channel: ${{ inputs.channel_id }}
59+
channel: ${{ env.SLACK_CHANNEL_ID }}
6360
ts: ${{ inputs.ts }}
6461
attachments:
6562
- color: "${{ steps.style.outputs.color }}"

.github/actions/slack-run-start/action.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ inputs:
1212
default: "#1d4ed8"
1313

1414
outputs:
15-
channel_id:
16-
description: Slack channel id for the posted message.
17-
value: ${{ steps.extract.outputs.channel_id }}
1815
ts:
1916
description: Slack message timestamp for updates.
2017
value: ${{ steps.extract.outputs.ts }}
@@ -45,19 +42,13 @@ runs:
4542
env:
4643
SLACK_RESPONSE: ${{ steps.post.outputs.response }}
4744
SLACK_TS: ${{ steps.post.outputs.ts }}
48-
SLACK_CHANNEL_ID: ${{ steps.post.outputs.channel_id }}
4945
run: |
5046
ts="$SLACK_TS"
51-
channel_id="$SLACK_CHANNEL_ID"
5247
5348
if [[ -n "$SLACK_RESPONSE" && "$SLACK_RESPONSE" != "null" ]]; then
5449
if [[ -z "$ts" ]]; then
5550
ts=$(echo "$SLACK_RESPONSE" | jq -r '.ts // empty')
5651
fi
57-
if [[ -z "$channel_id" ]]; then
58-
channel_id=$(echo "$SLACK_RESPONSE" | jq -r '.channel_id // .channel // empty')
59-
fi
6052
fi
6153
6254
echo "ts=$ts" >> "$GITHUB_OUTPUT"
63-
echo "channel_id=$channel_id" >> "$GITHUB_OUTPUT"

.github/workflows/deploy.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,9 @@ jobs:
133133
uk.co.bbc.bug.build.commit=${{ github.sha }}
134134
135135
- name: update slack message
136-
if: ${{ always() && steps.slack-start.outputs.ts != '' && steps.slack-start.outputs.channel_id != '' }}
136+
if: ${{ always() && steps.slack-start.outputs.ts != '' }}
137137
uses: ./.github/actions/slack-run-finish
138138
with:
139-
channel_id: ${{ steps.slack-start.outputs.channel_id }}
140139
ts: ${{ steps.slack-start.outputs.ts }}
141140
status: ${{ job.status }}
142141
message_prefix: Deployment

.github/workflows/documentation.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ jobs:
3434
name: Slack start message
3535
runs-on: ubuntu-latest
3636
outputs:
37-
channel_id: ${{ steps.slack-start.outputs.channel_id }}
3837
ts: ${{ steps.slack-start.outputs.ts }}
3938
steps:
4039
- name: checkout repository
@@ -46,7 +45,6 @@ jobs:
4645
with:
4746
message_prefix: Workflow running
4847

49-
# spell check documentation
5048
codespell:
5149
runs-on: ubuntu-latest
5250
steps:
@@ -60,7 +58,6 @@ jobs:
6058
only_warn: 1
6159
ignore_words_list: aoto,daa,te
6260

63-
# build storybook
6461
storybook:
6562
runs-on: ubuntu-latest
6663
steps:
@@ -81,7 +78,6 @@ jobs:
8178
name: storybook
8279
path: src/client/storybook-static
8380

84-
# build jekyll docs and include storybook + modules
8581
pages:
8682
runs-on: ubuntu-latest
8783
needs: storybook
@@ -95,23 +91,19 @@ jobs:
9591
name: storybook
9692
path: storybook-static
9793

98-
# merge storybook into docs folder before Jekyll build
9994
- name: Add Storybook to docs
10095
run: |
10196
mkdir -p docs/storybook
10297
cp -a storybook-static/* docs/storybook/
10398
104-
# setup node (needed to run modules generator)
10599
- name: Setup Node
106100
uses: actions/setup-node@v3
107101
with:
108102
node-version: 20
109103

110-
# install dependencies for modules script (js-yaml, etc.)
111104
- name: Install Dependencies
112105
run: npm ci
113106

114-
# generate modules pages before building site
115107
- name: Generate Modules Pages
116108
run: node docs/scripts/generateModules.js
117109

@@ -129,7 +121,6 @@ jobs:
129121
with:
130122
path: ./_site
131123

132-
# deploy to github pages
133124
deploy:
134125
needs: pages
135126
runs-on: ubuntu-latest
@@ -143,7 +134,7 @@ jobs:
143134

144135
slack-finish:
145136
name: Slack final status
146-
if: ${{ always() && needs.slack-start.result == 'success' && needs.slack-start.outputs.ts != '' && needs.slack-start.outputs.channel_id != '' }}
137+
if: ${{ always() && needs.slack-start.result == 'success' && needs.slack-start.outputs.ts != '' }}
147138
needs:
148139
- slack-start
149140
- codespell
@@ -171,7 +162,6 @@ jobs:
171162
- name: update slack message
172163
uses: ./.github/actions/slack-run-finish
173164
with:
174-
channel_id: ${{ needs.slack-start.outputs.channel_id }}
175165
ts: ${{ needs.slack-start.outputs.ts }}
176166
status: ${{ steps.workflow-status.outputs.status }}
177167
message_prefix: Workflow

.github/workflows/test-bug-client.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,9 @@ jobs:
4848
- run: cd src/client && npm run build --if-present
4949

5050
- name: update slack message
51-
if: ${{ always() && steps.slack-start.outputs.ts != '' && steps.slack-start.outputs.channel_id != '' }}
51+
if: ${{ always() && steps.slack-start.outputs.ts != '' }}
5252
uses: ./.github/actions/slack-run-finish
5353
with:
54-
channel_id: ${{ steps.slack-start.outputs.channel_id }}
5554
ts: ${{ steps.slack-start.outputs.ts }}
5655
status: ${{ job.status }}
5756
message_prefix: Workflow

.github/workflows/test-bug-server.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,9 @@ jobs:
4949
run: npm run test:server
5050

5151
- name: update slack message
52-
if: ${{ always() && steps.slack-start.outputs.ts != '' && steps.slack-start.outputs.channel_id != '' }}
52+
if: ${{ always() && steps.slack-start.outputs.ts != '' }}
5353
uses: ./.github/actions/slack-run-finish
5454
with:
55-
channel_id: ${{ steps.slack-start.outputs.channel_id }}
5655
ts: ${{ steps.slack-start.outputs.ts }}
5756
status: ${{ job.status }}
5857
message_prefix: Workflow

.github/workflows/test-module-container.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ jobs:
2222
name: Slack start message
2323
runs-on: ubuntu-latest
2424
outputs:
25-
channel_id: ${{ steps.slack-start.outputs.channel_id }}
2625
ts: ${{ steps.slack-start.outputs.ts }}
2726
steps:
2827
- name: checkout repository
@@ -219,7 +218,7 @@ jobs:
219218
220219
slack-finish:
221220
name: Slack final status
222-
if: ${{ always() && needs.slack-start.result == 'success' && needs.slack-start.outputs.ts != '' && needs.slack-start.outputs.channel_id != '' }}
221+
if: ${{ always() && needs.slack-start.result == 'success' && needs.slack-start.outputs.ts != '' }}
223222
needs:
224223
- slack-start
225224
- discover-modules
@@ -247,7 +246,6 @@ jobs:
247246
- name: update slack message
248247
uses: ./.github/actions/slack-run-finish
249248
with:
250-
channel_id: ${{ needs.slack-start.outputs.channel_id }}
251249
ts: ${{ needs.slack-start.outputs.ts }}
252250
status: ${{ steps.workflow-status.outputs.status }}
253251
message_prefix: Workflow

.github/workflows/versioning.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ jobs:
3030
name: Slack start message
3131
runs-on: ubuntu-latest
3232
outputs:
33-
channel_id: ${{ steps.slack-start.outputs.channel_id }}
3433
ts: ${{ steps.slack-start.outputs.ts }}
3534
steps:
3635
- name: checkout repository
@@ -138,7 +137,7 @@ jobs:
138137
139138
slack-finish:
140139
name: Slack final status
141-
if: ${{ always() && needs.slack-start.outputs.ts != '' && needs.slack-start.outputs.channel_id != '' }}
140+
if: ${{ always() && needs.slack-start.outputs.ts != '' }}
142141
needs:
143142
- slack-start
144143
- verify-tests
@@ -164,7 +163,6 @@ jobs:
164163
- name: update slack message
165164
uses: ./.github/actions/slack-run-finish
166165
with:
167-
channel_id: ${{ needs.slack-start.outputs.channel_id }}
168166
ts: ${{ needs.slack-start.outputs.ts }}
169167
status: ${{ steps.workflow-status.outputs.status }}
170168
message_prefix: Workflow

0 commit comments

Comments
 (0)