Invite the bot user into the Slack channel you will post messages to (/invite @bot_user_name)
Click the Slack channel name in the header, and copy its Channel ID from the bottom of the dialog
Usage
name: Deployon:
push:
branches:
- main# 1. Configure required environment variablesenv:
SLACK_DEPLOY_BOT_TOKEN: ${{ secrets.SLACK_DEPLOY_BOT_TOKEN }}SLACK_DEPLOY_CHANNEL: 'C040YVCUDRR'# replace with your Slack Channel IDjobs:
staging:
runs-on: ubuntu-latestoutputs:
slack_ts: ${{ steps.slack.outputs.ts }}steps:
# 2. Post summary message at the beginning of your workflow
- name: Post to Slackuses: Fieldguide/action-slack-deploy-pipeline@v2id: slack
- name: Deploy to stagingrun: sleep 10 # replace with your deploy steps# 3. Post threaded stage updates throughout
- name: Post to Slackuses: Fieldguide/action-slack-deploy-pipeline@v2if: always()with:
thread_ts: ${{ steps.slack.outputs.ts }}production:
needs:
- stagingruns-on: ubuntu-lateststeps:
- name: Deploy to productionrun: sleep 5 # replace with your deploy steps# 4. Post last "conclusion" stage
- name: Post to Slackuses: Fieldguide/action-slack-deploy-pipeline@v2if: always()with:
thread_ts: ${{ needs.staging.outputs.slack_ts }}conclusion: true
Configure required SLACK_DEPLOY_BOT_TOKEN and SLACK_DEPLOY_CHANNELenvironment variables.
Use this action at the beginning of your workflow to post a "Deploying" message in your configured channel.
As your workflow progresses, use this action with the thread_ts input to post threaded replies.
Denote the last step with the conclusion input to update the initial message's status.
Environment Variables
Both environment variables are required.
variable
description
SLACK_DEPLOY_BOT_TOKEN
Slack Bot User OAuth Token
SLACK_DEPLOY_CHANNEL
Slack Channel ID
Inputs
input
description
thread_ts
Initial Slack message timestamp ID
conclusion
true denotes last stage
github_token
Repository GITHUB_TOKEN or personal access token secret; defaults to github.token
status
The current status of the job; defaults to job.status