-
Notifications
You must be signed in to change notification settings - Fork 189
feat: add Slack CLI command runner workflow and installer composite action #489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,130 @@ | ||||||||||||||||||||||||||||||||
| name: Slack CLI Installation and Command Runner | ||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
🌲 suggestion: To match the |
||||||||||||||||||||||||||||||||
| description: Download and cache the Slack CLI and run the input command | ||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
🌞 suggestion: Perhaps idea on wording - I'm hoping to leave magic behind the scenes with this change but am not sure of the verbiage.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this! It's less verbose and more user-centric imo 🙇♀️ |
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| inputs: | ||||||||||||||||||||||||||||||||
| command: | ||||||||||||||||||||||||||||||||
| description: "Slack CLI command to run" | ||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
📚 suggestion: We can document some of these requirements here for the code curious! I'm never sure if these are surfaced elsewhere though...
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📚 suggestion: Also I think the descriptions for
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for this feedback - agreed! 🙌 |
||||||||||||||||||||||||||||||||
| type: string | ||||||||||||||||||||||||||||||||
| default: "" | ||||||||||||||||||||||||||||||||
| required: true | ||||||||||||||||||||||||||||||||
| verbose: | ||||||||||||||||||||||||||||||||
| description: "Verbose flag" | ||||||||||||||||||||||||||||||||
| type: boolean | ||||||||||||||||||||||||||||||||
| default: false | ||||||||||||||||||||||||||||||||
| required: false | ||||||||||||||||||||||||||||||||
| cli_version: | ||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
🐳 suggestion: It's unclear in official documentation what the recommended pattern is for input attributes, but I think "kebab" case is used most often, but it might be nice to change these in this |
||||||||||||||||||||||||||||||||
| description: "CLI Version" | ||||||||||||||||||||||||||||||||
| type: string | ||||||||||||||||||||||||||||||||
| default: "latest" | ||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
🚀 suggestion(non-blocking): I'm hoping we can soon land floating version in slackapi/slack-cli#199! For now the installation script should default to the latest without such specifier though. |
||||||||||||||||||||||||||||||||
| required: false | ||||||||||||||||||||||||||||||||
| app_id: | ||||||||||||||||||||||||||||||||
| description: "App ID" | ||||||||||||||||||||||||||||||||
| type: string | ||||||||||||||||||||||||||||||||
| default: "" | ||||||||||||||||||||||||||||||||
| required: false | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
Comment on lines
+20
to
+25
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
🪓 question: For now is this alright to remove? I believe it might conflict with a separate |
||||||||||||||||||||||||||||||||
| outputs: | ||||||||||||||||||||||||||||||||
| success: | ||||||||||||||||||||||||||||||||
| description: "Whether the command ran successfully" | ||||||||||||||||||||||||||||||||
| value: ${{ steps.run-slack-cli-command.outputs.success }} | ||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
📺 suggestion: To match a similar value of other techniques-
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
📝 suggestion: Some quick ideas on the description here too. |
||||||||||||||||||||||||||||||||
| exit_code: | ||||||||||||||||||||||||||||||||
| description: "Exit code" | ||||||||||||||||||||||||||||||||
| value: ${{ steps.run-slack-cli-command.outputs.exit_code }} | ||||||||||||||||||||||||||||||||
| command_executed: | ||||||||||||||||||||||||||||||||
| description: "Command ran" | ||||||||||||||||||||||||||||||||
| value: ${{ steps.run-slack-cli-command.outputs.command_executed }} | ||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
🪓 suggestion: Hmm... I'm not sure if we want to return this in addition to what the logs might show? 🗣️ ramble: There's a chance modifications from the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm yea I echo back the command input stored from |
||||||||||||||||||||||||||||||||
| stdout: | ||||||||||||||||||||||||||||||||
| description: "Command output" | ||||||||||||||||||||||||||||||||
| value: ${{ steps.run-slack-cli-command.outputs.stdout }} | ||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
📫 suggestion: We might want to capture both |
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| runs: | ||||||||||||||||||||||||||||||||
| using: composite | ||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||
| - name: Cache Slack CLI | ||||||||||||||||||||||||||||||||
| id: cache-cli | ||||||||||||||||||||||||||||||||
| uses: actions/cache@v4 | ||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
📍 suggestion: Let's use a pinned version here to avoid unexpected upstream changes! |
||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||
| path: | | ||||||||||||||||||||||||||||||||
| ${{ runner.os == 'Windows' && format('{0}/AppData/Local/slack-cli', env.USERPROFILE) || '~/.slack/bin' }} | ||||||||||||||||||||||||||||||||
| key: slack-cli-${{ runner.os }}-${{ runner.arch }}-${{ inputs.cli_version }} | ||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💰 praise: Super nice to be landing this in a first release. While installation is somewhat fast I think restoring from cache is often faster!
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤖 question: I notice the |
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - name: Add Slack CLI to PATH (Linux/macOS) | ||||||||||||||||||||||||||||||||
| if: runner.os != 'Windows' | ||||||||||||||||||||||||||||||||
| shell: bash | ||||||||||||||||||||||||||||||||
| run: echo "$HOME/.slack/bin" >> "$GITHUB_PATH" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - name: Add Slack CLI to PATH (Windows) | ||||||||||||||||||||||||||||||||
| if: runner.os == 'Windows' | ||||||||||||||||||||||||||||||||
| shell: pwsh | ||||||||||||||||||||||||||||||||
| run: Add-Content -Path $env:GITHUB_PATH -Value "$env:USERPROFILE\.slack\bin" | ||||||||||||||||||||||||||||||||
|
Comment on lines
+51
to
+59
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👾 question: Are these steps needed just if the cache was found? Unsure if the installation script has similar effects or if this could be skipped...
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah yes seems like I would need to move the action to the root level so |
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - name: Install Slack CLI (Linux/macOS) | ||||||||||||||||||||||||||||||||
| if: | ||||||||||||||||||||||||||||||||
| (runner.os == 'Linux' || runner.os == 'macOS') && | ||||||||||||||||||||||||||||||||
| (steps.cache-cli.outputs.cache-hit != 'true') | ||||||||||||||||||||||||||||||||
| shell: bash | ||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||
| curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash -s -- -v ${{ inputs.cli_version }} --skip-update | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - name: Install Slack CLI (Windows) | ||||||||||||||||||||||||||||||||
| if: | ||||||||||||||||||||||||||||||||
| runner.os == 'Windows' && | ||||||||||||||||||||||||||||||||
| (steps.cache-cli.outputs.cache-hit != 'true') | ||||||||||||||||||||||||||||||||
| shell: pwsh | ||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||
| irm https://downloads.slack-edge.com/slack-cli/install-windows-dev.ps1 | iex -- -v ${{ inputs.cli_version }} | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - name: Run Slack CLI Command (Linux/macOS) | ||||||||||||||||||||||||||||||||
| if: runner.os != 'Windows' | ||||||||||||||||||||||||||||||||
| id: run-slack-cli-command | ||||||||||||||||||||||||||||||||
| shell: bash | ||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||
| SLACK_SERVICE_TOKEN: $SLACK_SERVICE_TOKEN | ||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🪬 suggestion: We might prefer to use an explicit
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me know if I misunderstand, but wouldn't the user need to repeatedly put their token as an input? Or is it still saved in secrets so they don't need to regularly retrieve it?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ewanek1 You're right that the I'm curious if we can fallback to environment variables if a token isn't provided in inputs but the order of which token to use, if app and bot tokens are options, might be confusing for other techniques too. Also, I also confirmed that a token provided by flag isn't saved to file by the CLI to avoid later unexpected happenings with a service token, so this might be similar to current behavior as well? |
||||||||||||||||||||||||||||||||
| VERBOSE: ${{ inputs.verbose }} | ||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⌛ question: Is this used as a variable or can we also remove it?
Suggested change
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for catching this I never used this and it can be removed 😄 |
||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||
| cmd="slack ${{ inputs.command }}" | ||||||||||||||||||||||||||||||||
| if [ "${{ inputs.verbose }}" == "true" ]; then | ||||||||||||||||||||||||||||||||
| cmd="$cmd --verbose" | ||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||
| cmd="$cmd --skip-update" | ||||||||||||||||||||||||||||||||
|
Comment on lines
+83
to
+89
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
🌐 suggestion(non-blocking): Using an environment variable instead might make this logic more clear?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed - thanks! |
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| output=$(eval $cmd 2>&1) | ||||||||||||||||||||||||||||||||
| exit_code=$? | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| echo "Command output: $output" | ||||||||||||||||||||||||||||||||
| echo "Exit code: $exit_code" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
Comment on lines
+94
to
+96
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
🪓 thought: If these are duplicating outputs it might be alright to remove?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll check if the exit code is necessary! I believe Actions resurfaces the error anyways. |
||||||||||||||||||||||||||||||||
| echo "success=$([ $exit_code -eq 0 ] && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||
| echo "exit_code=$exit_code" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||
| echo "command_executed=slack ${{ inputs.command }} --skip-update" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| echo "stdout<<EOF" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||
| echo "$output" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||
| echo "EOF" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - name: Run Slack CLI Command (Windows) | ||||||||||||||||||||||||||||||||
| if: runner.os == 'Windows' | ||||||||||||||||||||||||||||||||
| id: run-slack-cli-command-windows | ||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🍃 question: Do the outputs from this step also map to the outputs of the workflow? I notice a different
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an oversight thank you!! |
||||||||||||||||||||||||||||||||
| shell: pwsh | ||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||
| SLACK_SERVICE_TOKEN: $SLACK_SERVICE_TOKEN | ||||||||||||||||||||||||||||||||
| VERBOSE: ${{ inputs.verbose }} | ||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||
| $cmd = "slack ${{ inputs.command }}" | ||||||||||||||||||||||||||||||||
| if ("${{ inputs.verbose }}" -eq "true") { $cmd += " --verbose" } | ||||||||||||||||||||||||||||||||
| $cmd += " --skip-update" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| $output = & $cmd 2>&1 | ||||||||||||||||||||||||||||||||
| $exit_code = $LASTEXITCODE | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| Write-Host "Command output: $output" | ||||||||||||||||||||||||||||||||
| Write-Host "Exit code: $exit_code" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| "success=$($exit_code -eq 0)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | ||||||||||||||||||||||||||||||||
| "exit_code=$exit_code" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | ||||||||||||||||||||||||||||||||
| "command_executed=$cmd" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| "stdout<<EOF" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | ||||||||||||||||||||||||||||||||
| $output | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | ||||||||||||||||||||||||||||||||
| "EOF" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,160 @@ | ||||||||
| name: Slack CLI Command Runner Tests | ||||||||
|
|
||||||||
| on: | ||||||||
| pull_request: | ||||||||
|
|
||||||||
| jobs: | ||||||||
| test-all: | ||||||||
| runs-on: ubuntu-latest | ||||||||
| steps: | ||||||||
| - uses: actions/checkout@v4 | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
👁️🗨️ suggestion: Guards against unexpected changes upstream! |
||||||||
|
|
||||||||
| - name: Run slack version | ||||||||
| id: version | ||||||||
| uses: ./.github/resources/.actions/cli-runner | ||||||||
| with: | ||||||||
| command: "version" | ||||||||
|
Comment on lines
+13
to
+17
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧪 suggestion: It might be interesting to run this test across multiple runners - ubuntu, mac, and windows?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes! |
||||||||
| cli_version: "latest" | ||||||||
| env: | ||||||||
| SLACK_SERVICE_TOKEN: ${{ secrets.SLACK_SERVICE_TOKEN }} | ||||||||
|
|
||||||||
| - name: Debug outputs | ||||||||
| run: | | ||||||||
| echo "stdout: '${{ steps.version.outputs.stdout }}'" | ||||||||
| echo "success: '${{ steps.version.outputs.success }}'" | ||||||||
| echo "command executed: '${{ steps.version.outputs.command_executed }}'" | ||||||||
|
|
||||||||
| - name: Verify CLI version | ||||||||
| if: steps.version.outputs.success != 'true' | ||||||||
| run: | | ||||||||
| echo "CLI version command failure" | ||||||||
| echo "stdout: ${{ steps.version.outputs.stdout }}" | ||||||||
| exit 1 | ||||||||
|
|
||||||||
| - name: Empty command | ||||||||
| id: empty-command | ||||||||
| uses: ./.github/resources/.actions/cli-runner | ||||||||
| with: | ||||||||
| command: "" | ||||||||
| cli_version: "latest" | ||||||||
| env: | ||||||||
| SLACK_SERVICE_TOKEN: ${{ secrets.SLACK_SERVICE_TOKEN }} | ||||||||
|
|
||||||||
| - name: Command with whitespace | ||||||||
| id: command-with-whitespace | ||||||||
| uses: ./.github/resources/.actions/cli-runner | ||||||||
| with: | ||||||||
| command: " version" | ||||||||
| cli_version: "latest" | ||||||||
| env: | ||||||||
| SLACK_SERVICE_TOKEN: ${{ secrets.SLACK_SERVICE_TOKEN }} | ||||||||
|
|
||||||||
| - name: Long command with flags | ||||||||
| id: long-command | ||||||||
| uses: ./.github/resources/.actions/cli-runner | ||||||||
| with: | ||||||||
| command: 'doctor --help --experiment string' | ||||||||
| cli_version: "latest" | ||||||||
| env: | ||||||||
| SLACK_SERVICE_TOKEN: ${{ secrets.SLACK_SERVICE_TOKEN }} | ||||||||
|
Comment on lines
+52
to
+60
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧪 suggestion(non-blocking): We should follow up with a test that uses both the 🗣️ ramble: I'm not certain if this environment variable can be gathered from the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed similar to what I have for verbose. |
||||||||
|
|
||||||||
| - name: Ensure empty command works | ||||||||
| if: steps.empty-command.outputs.success != 'true' | ||||||||
| run: | | ||||||||
| echo "Empty command failure" | ||||||||
| echo "success: '${{ steps.empty-command.outputs.success }}'" | ||||||||
| echo "stdout: '${{ steps.empty-command.outputs.stdout }}'" | ||||||||
| exit 1 | ||||||||
|
|
||||||||
| - name: Ensure command with whitespace | ||||||||
| if: steps.command-with-whitespace.outputs.success != 'true' | ||||||||
| run: | | ||||||||
| echo "Command with whitespace failure" | ||||||||
| echo "success: '${{ steps.command-with-whitespace.outputs.success }}'" | ||||||||
| echo "stdout: '${{ steps.command-with-whitespace.outputs.stdout }}'" | ||||||||
| exit 1 | ||||||||
|
|
||||||||
| - name: Ensure long command works | ||||||||
| if: steps.long-command.outputs.success != 'true' | ||||||||
| run: | | ||||||||
| echo "Long command failure" | ||||||||
| echo "success: '${{ steps.long-command.outputs.success }}'" | ||||||||
| echo "stdout: '${{ steps.long-command.outputs.stdout }}'" | ||||||||
| exit 1 | ||||||||
|
|
||||||||
| - name: Run with verbose | ||||||||
| id: with-verbose | ||||||||
| uses: ./.github/resources/.actions/cli-runner | ||||||||
| with: | ||||||||
| command: "help" | ||||||||
| cli_version: "latest" | ||||||||
| verbose: "true" | ||||||||
| env: | ||||||||
| SLACK_SERVICE_TOKEN: ${{ secrets.SLACK_SERVICE_TOKEN }} | ||||||||
|
|
||||||||
| - name: Ensure verbose flag worked | ||||||||
| if: steps.with-verbose.outputs.success != 'true' | ||||||||
| run: | | ||||||||
| echo "Verbose flag failure" | ||||||||
| echo "success: '${{ steps.with-verbose.outputs.success }}'" | ||||||||
| echo "stdout: '${{ steps.with-verbose.outputs.stdout }}'" | ||||||||
| exit 1 | ||||||||
|
|
||||||||
| - name: First run (install if missing) | ||||||||
| id: no-cache | ||||||||
| uses: ./.github/resources/.actions/cli-runner | ||||||||
| with: | ||||||||
| command: "version" | ||||||||
| cli_version: "latest" | ||||||||
| env: | ||||||||
| SLACK_SERVICE_TOKEN: ${{ secrets.SLACK_SERVICE_TOKEN }} | ||||||||
|
|
||||||||
| - name: Second run (cache hit) | ||||||||
| id: cache-hit | ||||||||
| uses: ./.github/resources/.actions/cli-runner | ||||||||
| with: | ||||||||
| command: "version" | ||||||||
| cli_version: "latest" | ||||||||
| env: | ||||||||
| SLACK_SERVICE_TOKEN: ${{ secrets.SLACK_SERVICE_TOKEN }} | ||||||||
| SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||||||||
|
|
||||||||
| - name: Ensure cache worked | ||||||||
| if: github.run_attempt > 1 && steps.cache-hit.outputs.success != 'true' | ||||||||
| run: | | ||||||||
| echo "cache failure" | ||||||||
| exit 1 | ||||||||
|
|
||||||||
| - name: Run with invalid command | ||||||||
| id: invalid-command | ||||||||
| continue-on-error: true | ||||||||
| uses: ./.github/resources/.actions/cli-runner | ||||||||
| with: | ||||||||
| command: "invalid-command" | ||||||||
| cli_version: "latest" | ||||||||
| env: | ||||||||
| SLACK_SERVICE_TOKEN: ${{ secrets.SLACK_SERVICE_TOKEN }} | ||||||||
|
|
||||||||
| - name: Expect failure | ||||||||
| if: steps.invalid-command.outputs.success == 'true' | ||||||||
| run: | | ||||||||
| echo "Expected failure with invalid command" | ||||||||
| echo "stdout: '${{ steps.invalid-command.outputs.stdout }}'" | ||||||||
| echo "success: '${{ steps.invalid-command.outputs.success }}'" | ||||||||
| exit 1 | ||||||||
|
|
||||||||
| - name: Test specific version | ||||||||
| id: specific-version | ||||||||
| uses: ./.github/resources/.actions/cli-runner | ||||||||
| with: | ||||||||
| command: "version" | ||||||||
| cli_version: "3.5.0" | ||||||||
| env: | ||||||||
| SLACK_SERVICE_TOKEN: ${{ secrets.SLACK_SERVICE_TOKEN }} | ||||||||
|
|
||||||||
| - name: Ensure specific version | ||||||||
| if: ${{ !contains(steps.specific-version.outputs.stdout, '3.5.0') }} | ||||||||
| run: | | ||||||||
| echo "Specific version failure" | ||||||||
| echo "stdout: '${{ steps.specific-version.outputs.stdout }}'" | ||||||||
| exit 1 | ||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⭐ praise: We've discussed this setup and I think the separated action definition is a nice pattern to use for the CLI technique! Thanks for encouraging this!
👁️🗨️ thought: The exact calling syntax escapes me but for releases it'd be so interesting to find this pattern in calling workflows: