| sidebar_label | Overview |
|---|
The Slack CLI technique installs and runs Slack CLI commands directly from a GitHub Actions workflow.
This is useful for automating tasks such as deploying apps, validating an app manifest, or interacting with Slack platform features that are available with the CLI.
Pass a service token via the token input. This is appended as --token <value> to the CLI command. The slack auth token command can be used to gather this.
By default, the latest version of the Slack CLI is installed. To pin a specific version, use the version input:
- uses: slackapi/slack-github-action/[email protected]
with:
command: "version"
version: "3.14.0"If the slack command already exists on PATH, installation is skipped entirely.
Provide a command input with the Slack CLI command to run, omitting the slack prefix.
- uses: slackapi/slack-github-action/[email protected]
with:
command: "version"When a workflow is re-run with Enable debug logging, the action automatically appends --verbose to the CLI command. You can also include --verbose in your command input manually at any time.
- uses: slackapi/slack-github-action/[email protected]
with:
command: "deploy --app ${{ vars.SLACK_APP_ID }} --verbose"
token: ${{ secrets.SLACK_SERVICE_TOKEN }}The following outputs are available after a CLI command runs:
| Output | Type | Description |
|---|---|---|
ok |
boolean |
If the command completed with a 0 exit code. |
response |
string |
The standard output from the CLI command. |
time |
number |
The Unix epoch time that the step completed. |
steps:
- uses: slackapi/slack-github-action/[email protected]
id: slack
with:
command: "version"
- run: echo "${{ steps.slack.outputs.response }}"steps:
- uses: actions/checkout@v4
- uses: slackapi/slack-github-action/[email protected]
with:
command: "manifest validate --app ${{ vars.SLACK_APP_ID }}"
token: ${{ secrets.SLACK_SERVICE_TOKEN }}steps:
- uses: actions/checkout@v4
- uses: slackapi/slack-github-action/[email protected]
with:
command: "deploy --app ${{ vars.SLACK_APP_ID }} --force"
token: ${{ secrets.SLACK_SERVICE_TOKEN }}- Deploy an app: Deploy to Slack on push to the main branch.
- Validate a manifest: Check the app manifest on pull requests.
- Manage collaborators: Add or remove an app collaborator using CLI and API techniques together.