-
Notifications
You must be signed in to change notification settings - Fork 178
feat: add Slack CLI command runner workflow and installer composite action #488
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
Open
ewanek1
wants to merge
1
commit into
feature/slack-cli-runner
Choose a base branch
from
ewanek1-slack-cli-command-runner-v2
base: feature/slack-cli-runner
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| name: Slack CLI Installation and Command Runner | ||
| description: Download and cache the Slack CLI and run the input command | ||
|
|
||
| inputs: | ||
| command: | ||
| description: "Slack CLI command to run" | ||
| required: true | ||
| verbose: | ||
| description: "Enable verbose output" | ||
| required: false | ||
| default: 'false' | ||
| cli_version: | ||
| description: "Slack CLI Version" | ||
| required: false | ||
| default: '3.6.0' | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Cache Slack CLI | ||
| id: cache-cli | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.slack/bin | ||
| key: slack-cli-${{ runner.os }}-${{ runner.arch }}-${{ inputs.cli_version }} | ||
|
|
||
| - 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" | ||
|
|
||
| - 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 | ||
|
|
||
| - name: Run Slack CLI Command | ||
| shell: bash | ||
| env: | ||
| SLACK_SERVICE_TOKEN: $SLACK_SERVICE_TOKEN | ||
| SLACK_BOT_TOKEN: $SLACK_BOT_TOKEN | ||
| VERBOSE: ${{ inputs.verbose }} | ||
| run: | | ||
| echo "Running command: ${{ inputs.command }}" | ||
| if [ "${{ inputs.verbose }}" == "true" ]; then | ||
| slack ${{ inputs.command }} --verbose --skip-update | ||
| else | ||
| slack ${{ inputs.command }} --skip-update | ||
| fi | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| name: Slack CLI Command Runner | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| command: | ||
| description: 'Slack CLI command to run' | ||
| required: true | ||
| verbose: | ||
| description: 'Verbose flag' | ||
| type: boolean | ||
| default: false | ||
| cli_version: | ||
| description: 'Slack CLI version' | ||
| required: false | ||
| default: "latest" | ||
|
|
||
| env: | ||
| SLACK_DISABLE_TELEMETRY: "true" | ||
|
|
||
| jobs: | ||
| deploy: | ||
| permissions: | ||
| contents: read | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Slack CLI and Run Command | ||
| uses: ./.github/.actions/slack-cli-runner | ||
| with: | ||
| command: ${{ github.event.inputs.command }} | ||
| verbose: ${{ github.run_attempt > 1 }} | ||
| cli_version: ${{ github.event.inputs.cli_version }} | ||
| env: | ||
| SLACK_SERVICE_TOKEN: ${{ secrets.SLACK_SERVICE_TOKEN }} | ||
| SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
📝 note: Changes of
devexist in this PR: slackapi/slack-cli#178👁️🗨️ suggestion: I might've shared an incomplete command with this link too but perhaps this brings better luck? Let's keep note to test this at some point-
Uh oh!
There was an error while loading. Please reload this page.
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.
Luckily I think this let the CLI install properly! Although now it hangs on the very last step in the script. It echoes the command
Run slack version --skip-updatebut doesn't go any further 🤔 Before this I got this errorThe term 'slack' is not recognized as a name of a cmdletso I wonder if it has to do with the PATH variable. I'll keep trying to look into this!