Skip to content

Commit c6baa4b

Browse files
committed
test: improve checks of existing cache or path
1 parent 2d3baa1 commit c6baa4b

2 files changed

Lines changed: 38 additions & 33 deletions

File tree

.github/workflows/integration.yml

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
env:
6969
INPUT_REF: ${{ inputs.ref }}
7070

71-
- name: "integration(wfb): send a payload to workflow builder via webhook trigger"
71+
- name: "test(wfb): send a payload to workflow builder via webhook trigger"
7272
id: wfb
7373
uses: ./
7474
with:
@@ -82,12 +82,12 @@ jobs:
8282
repo_name: ${{ github.event.repository.full_name }}
8383
status: ${{ job.status }}
8484
85-
- name: "integration(wfb): confirm a payload was sent"
85+
- name: "test(wfb): confirm a payload was sent"
8686
run: test -n "$WFB_OUTPUT_TIME"
8787
env:
8888
WFB_OUTPUT_TIME: ${{ steps.wfb.outputs.time }}
8989

90-
- name: "integration(botToken): post a message to channel"
90+
- name: "test(api): post a message to channel"
9191
id: message
9292
uses: ./
9393
with:
@@ -98,12 +98,12 @@ jobs:
9898
channel: ${{ secrets.SLACK_CHANNEL_ID }}
9999
text: ":checkered_flag: Action happens at <https://github.com/${{ github.repository }}>"
100100
101-
- name: "integration(method): confirm a message was posted"
101+
- name: "test(api): confirm a message was posted"
102102
run: test -n "$MESSAGE_OUTPUT_TS"
103103
env:
104104
MESSAGE_OUTPUT_TS: ${{ steps.message.outputs.ts }}
105105

106-
- name: "integration(method): post a message with blocks"
106+
- name: "test(api): post a message with blocks"
107107
id: blocks
108108
uses: ./
109109
with:
@@ -120,12 +120,12 @@ jobs:
120120
short: true
121121
value: "Processing"
122122
123-
- name: "integration(method): confirm the blocks were posted"
123+
- name: "test(api): confirm the blocks were posted"
124124
run: test -n "$BLOCKS_OUTPUT_TS"
125125
env:
126126
BLOCKS_OUTPUT_TS: ${{ steps.blocks.outputs.ts }}
127127

128-
- name: "integration(method): post a threaded message"
128+
- name: "test(api): post a threaded message"
129129
id: timer
130130
uses: ./
131131
with:
@@ -137,15 +137,15 @@ jobs:
137137
text: "Started at `${{ steps.blocks.outputs.time }}`"
138138
thread_ts: "${{ steps.blocks.outputs.ts }}"
139139
140-
- name: "integration(incoming): confirm the thread started"
140+
- name: "test(api): confirm the thread started"
141141
run: test -n "$TIMER_OUTPUT_TIME"
142142
env:
143143
TIMER_OUTPUT_TIME: ${{ steps.timer.outputs.time }}
144144

145-
- name: "integration(method): wait to mock event processing"
145+
- name: "test(api): wait to mock event processing"
146146
run: sleep 3
147147

148-
- name: "integration(method): update the original message"
148+
- name: "test(api): update the original message"
149149
id: finished
150150
uses: ./
151151
with:
@@ -163,7 +163,7 @@ jobs:
163163
short: true
164164
value: "Completed"
165165
166-
- name: "integration(method): post another threaded message"
166+
- name: "test(api): post another threaded message"
167167
id: done
168168
uses: ./
169169
with:
@@ -175,7 +175,7 @@ jobs:
175175
text: "Finished at `${{ steps.finished.outputs.time }}`"
176176
thread_ts: "${{ steps.timer.outputs.thread_ts }}"
177177
178-
- name: "integration(method): post a file into a channel"
178+
- name: "test(api): post a file into a channel"
179179
id: file
180180
uses: ./
181181
with:
@@ -188,7 +188,7 @@ jobs:
188188
file: .github/workflows/integration.yml
189189
filename: integration.yml
190190
191-
- name: "integration(method): react to the completed update message"
191+
- name: "test(api): react to the completed update message"
192192
uses: ./
193193
with:
194194
errors: true
@@ -199,12 +199,12 @@ jobs:
199199
timestamp: ${{ steps.blocks.outputs.ts }}
200200
name: "tada"
201201
202-
- name: "integration(method): confirm the thread ended"
202+
- name: "test(api): confirm the thread ended"
203203
run: test -n "$DONE_OUTPUT_TIME"
204204
env:
205205
DONE_OUTPUT_TIME: ${{ steps.done.outputs.time }}
206206

207-
- name: "integration(incoming): post a message via incoming webhook"
207+
- name: "test(incoming): post a message via incoming webhook"
208208
id: incoming
209209
uses: ./
210210
with:
@@ -220,17 +220,17 @@ jobs:
220220
text: ":link: A message was received via incoming webhook"
221221
emoji: true
222222
223-
- name: "integration(incoming): confirm a webhook was posted"
223+
- name: "test(incoming): confirm a webhook was posted"
224224
run: test -n "$INCOMING_WEBHOOK_OUTPUT_TIME"
225225
env:
226226
INCOMING_WEBHOOK_OUTPUT_TIME: ${{ steps.incoming.outputs.time }}
227227

228-
- name: "integration(incoming): reveal contents of the github payload"
228+
- name: "test(incoming): reveal contents of the github payload"
229229
run: echo "$JSON"
230230
env:
231231
JSON: ${{ toJSON(github) }}
232232

233-
- name: "integration(incoming): post a message via payload file"
233+
- name: "test(incoming): post a message via payload file"
234234
id: payload_file
235235
uses: ./
236236
with:
@@ -243,7 +243,7 @@ jobs:
243243
JOB_STATUS: ${{ job.status }}
244244
ATTACHMENT_COLOR: ${{ (job.status == 'success' && 'good') || (job.status == 'failure' && 'danger') || 'warning' }}
245245

246-
- name: "integration(incoming): confirm a payload file was posted"
246+
- name: "test(incoming): confirm a payload file was posted"
247247
run: test -n "$PAYLOAD_FILE_OUTPUT_TIME"
248248
env:
249249
PAYLOAD_FILE_OUTPUT_TIME: ${{ steps.payload_file.outputs.time }}
@@ -266,8 +266,13 @@ jobs:
266266
persist-credentials: false
267267
ref: ${{ inputs.ref || github.event.pull_request.head.sha || github.sha }}
268268

269-
- name: "integration(cli): run a slack cli version check"
269+
- name: "test(cli): run a slack cli version check"
270270
uses: ./cli
271271
with:
272272
command: "version"
273273
version: "3.13.0-fix-windows-ci-feature"
274+
275+
- name: "test(cli): run a slack cli version check again"
276+
uses: ./cli
277+
with:
278+
command: "version"

cli/action.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,33 @@ runs:
2929
shell: bash
3030
run: |
3131
if command -v slack &> /dev/null; then
32-
echo "cli-exists=true" >> "$GITHUB_OUTPUT"
32+
echo "exists=true" >> "$GITHUB_OUTPUT"
3333
else
34-
echo "cli-exists=false" >> "$GITHUB_OUTPUT"
34+
echo "exists=false" >> "$GITHUB_OUTPUT"
3535
fi
3636
3737
- name: Cache Slack CLI
38-
if: steps.slack-cli-check.outputs.cli-exists != 'true'
38+
if: steps.slack-cli-check.outputs.exists != 'true'
3939
id: cache-cli
4040
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
4141
with:
4242
path: |
4343
${{ runner.os == 'Windows' && format('{0}\AppData\Local\slack-cli', env.USERPROFILE) || format('{0}/.slack/bin', env.HOME) }}
4444
key: slack-cli-${{ runner.os }}-${{ runner.arch }}-${{ inputs.version }}
4545

46-
- name: Add Slack CLI to PATH (Linux/macOS)
47-
if: steps.slack-cli-check.outputs.cli-exists != 'true' && runner.os != 'Windows'
46+
- name: Add Slack CLI to PATH
47+
if: steps.slack-cli-check.outputs.exists != 'true' && runner.os != 'Windows'
4848
shell: bash
4949
run: echo "$HOME/.slack/bin" >> "$GITHUB_PATH" # zizmor: ignore[github-env]
5050

51-
- name: Add Slack CLI to PATH (Windows)
52-
if: steps.slack-cli-check.outputs.cli-exists != 'true' && runner.os == 'Windows'
51+
- name: Add Slack CLI to PATH
52+
if: steps.slack-cli-check.outputs.exists != 'true' && runner.os == 'Windows'
5353
shell: pwsh
5454
run: Add-Content -Path $env:GITHUB_PATH -Value "$env:USERPROFILE\AppData\Local\slack-cli\bin" # zizmor: ignore[github-env]
5555

56-
- name: Install Slack CLI (Linux/macOS)
56+
- name: Install Slack CLI
5757
if: >-
58-
steps.slack-cli-check.outputs.cli-exists != 'true' &&
58+
steps.slack-cli-check.outputs.exists != 'true' &&
5959
steps.cache-cli.outputs.cache-hit != 'true' &&
6060
runner.os != 'Windows'
6161
shell: bash
@@ -68,9 +68,9 @@ runs:
6868
env:
6969
SLACK_CLI_VERSION: ${{ inputs.version }}
7070

71-
- name: Install Slack CLI (Windows)
71+
- name: Install Slack CLI
7272
if: >-
73-
steps.slack-cli-check.outputs.cli-exists != 'true' &&
73+
steps.slack-cli-check.outputs.exists != 'true' &&
7474
steps.cache-cli.outputs.cache-hit != 'true' &&
7575
runner.os == 'Windows'
7676
shell: pwsh
@@ -85,7 +85,7 @@ runs:
8585
env:
8686
SLACK_CLI_VERSION: ${{ inputs.version }}
8787

88-
- name: Run Slack CLI command (Linux/macOS)
88+
- name: Run Slack CLI command
8989
if: runner.os != 'Windows'
9090
id: slack-cli-unix
9191
shell: bash
@@ -115,7 +115,7 @@ runs:
115115
exit $exit_code
116116
fi
117117
118-
- name: Run Slack CLI command (Windows)
118+
- name: Run Slack CLI command
119119
if: runner.os == 'Windows'
120120
id: slack-cli-windows
121121
shell: pwsh

0 commit comments

Comments
 (0)