This is a proof of concept for using interactive messages on Slack as a manual approval for triggering a deployment of an application using GitHub Actions.
The flow goes like this:
- Developer commits code to a GitHub repository, triggering a "build" workflow
- At the end of the workflow, if everything has succeeded, the workflow sends an interactive message to a Slack channel that includes two buttons,
Deploy
orAbort
. - On
Deploy
: Use the repository dispatch event to trigger a "deploy" workflow, that can deploy the application to the cloud. - On
Abort
: Simply don't do anything. This is where one can clean up generated images and more if necessary.
The PoC consists of two components:
This is implemented as a GitHub Action and can be easily used in existing workflows. The component is located in send-slack-message.
When a user clicks a button in the interactive Slack message, this component receives the event, and generates a deployment. The component is located in event-handler, and is based on the @slack/interactive-messages library.
MIT