Skip to content

Conversation

@ewanek1
Copy link

@ewanek1 ewanek1 commented Sep 3, 2025

Summary

This PR builds upon #488 and #486. It continues iterating on the GitHub composite action and workflow that runs Slack CLI commands directly in CI/CD.

Notes on Major Changes

Built a testing workflow that triggers on a pull request

Updated workflow to be reusable and callable by users in their own repositories

Wrote documentation

Included an app_id input option

Added support for Windows

Requirements

Copy link
Member

@zimeg zimeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ewanek1 This is an incredible set of changes from the prior PR! I'm marking it as approved with all things moving in a good direction 🎉

Handfuls of comments and thoughts and suggestions follow that I do think we'll want to address before a public release, but these don't have to block prereleases IMHO 🚂 💨

The comments on inputs and outputs would be most curious to discuss since these are difficult to change after release, but I'm super curious what you think about other comments as well!

Huge thanks for working on all of this and maintaining support for setups of all kind 🎁 ✨

Copy link
Member

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:

- uses: slackapi/slack-github-action/cli@v2
  with:
    command: version

Comment on lines +51 to +59
- 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"
Copy link
Member

Choose a reason for hiding this comment

The 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...

Copy link
Author

Choose a reason for hiding this comment

The 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 slack-github-action/cli/action.yml. Instead of having it under .github/resources/.actions

Comment on lines 43 to 49
- name: Cache Slack CLI
id: cache-cli
uses: actions/cache@v4
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 }}
Copy link
Member

Choose a reason for hiding this comment

The 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!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 question: I notice the ~ is used when checking this path but the $HOME variable is used following. Would using the $HOME variable here be possible too?

@@ -0,0 +1,130 @@
name: Slack CLI Installation and Command Runner
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: Slack CLI Installation and Command Runner
name: "Slack: Run a CLI command"

🌲 suggestion: To match the action.yml file for other techniques!

@@ -0,0 +1,130 @@
name: Slack CLI Installation and Command Runner
description: Download and cache the Slack CLI and run the input command
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: Download and cache the Slack CLI and run the input command
description: "Install the Slack CLI to run a command"

🌞 suggestion: Perhaps idea on wording - I'm hoping to leave magic behind the scenes with this change but am not sure of the verbiage.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this! It's less verbose and more user-centric imo 🙇‍♀️

timeout-minutes: 5

steps:
- uses: actions/checkout@v4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- uses: actions/checkout@v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

test-all:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- uses: actions/checkout@v4
- name: Checkout the current code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

👁️‍🗨️ suggestion: Guards against unexpected changes upstream!

Comment on lines +12 to +16
- name: Run slack version
id: version
uses: ./.github/resources/.actions/cli-runner
with:
command: "version"
Copy link
Member

Choose a reason for hiding this comment

The 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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!

Comment on lines 52 to 59
- 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 }}
Copy link
Member

Choose a reason for hiding this comment

The 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 --app and token value to make sure all things reach the Slack API as expected:

manifest --app $SLACK_APP_ID

🗣️ ramble: I'm not certain if this environment variable can be gathered from the env but that'd be a nice thing to find in test I hope too?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed similar to what I have for verbose.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 suggestion: Following a prior comment on documentation and example, this might be nice to include in our example workflows?

🦕 thought: I can imagine running the CLI technique on merges to main as well to keep our testing app current:

🔗 https://github.com/slackapi/slack-github-action/tree/main/.github/resources/.slack

@codecov
Copy link

codecov bot commented Sep 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.86%. Comparing base (c7d8f2c) to head (04ab2f1).

Additional details and impacted files
@@                         Coverage Diff                          @@
##           ewanek1-slack-cli-command-runner-v2     #489   +/-   ##
====================================================================
  Coverage                                99.86%   99.86%           
====================================================================
  Files                                        7        7           
  Lines                                      722      722           
====================================================================
  Hits                                       721      721           
  Misses                                       1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request semver:minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants