GitHub Action for triggering GitHub workflow_dispatch event by Slack.
MIT License
GitHub Action for triggering GitHub workflow_dispatch event by Slack.
This action is assumed to be used with a Slack app that handles its interaction payload and trigger the workflow. This can be easily done by Terraform with github-workflow-dispatch-slack Terraform module.
Name | Description | Required | Default |
---|---|---|---|
repository |
Owner and repository name | No | ${{ github.repository }} |
workflow |
Workflow ID or file name | Yes | N/A |
ref |
Git reference for the workflow | No | See (*1) |
inputs |
Input keys and values configured in the workflow file | No | N/A |
github-token |
GitHub token | No |
${{ env.GITHUB_TOKEN }} or ${{ github.token }}
|
channel |
Slack channel name | No (*2) | N/A |
slack-bot-token |
Slack bot token | No (*2) | ${{ env.SLACK_BOT_TOKEN }} |
slack-webhook-url |
Slack webhook URL | No (*2) | ${{ env.SLACK_WEBHOOK_URL }} |
mention |
Slack user ID to mention | No | N/A |
ref
default value are determined by the repository
input and the event type as follows:
repository value |
Event type |
ref default value |
---|---|---|
${{ github.repository }} |
pull_request |
${{ github.event.pull_request.head.ref }} |
${{ github.repository }} |
Not pull_request
|
${{ github.ref }} |
Not ${{ github.repository }}
|
* | Default branch of the repository |
channel
and slack-bot-token
both or slack-webhook-url
.
my-job:
runs-on: ubuntu-latest
needs:
- plan
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Trigger the workflow by Slack bot
uses: kota65535/github-workflow-dispatch-slack-action@v1
with:
workflow: do-something.yml
inputs: '{"foo":"1","bar":"2"}'
channel: my-ci
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}