A minimal integration of Github slash commands, status checks, and deployment statuses with SST deployment workflows.
This repository demonstrates how to add manual, slash-based triggers to deploy, destroy, and staging, allowing maintainers to manage SST deployments without requiring local AWS credentials.
Note
This repository deploys an unmodified Next.js application to AWS via SST. No further focus will be given to the application itself.
There are three classes of workflows:
deploy(one for production, one for staging)destroy_stagingunlock_staging
The deploy workflow runs automatically when a branch is created or updated. The destroy workflow runs automatically when a branch is closed.
We make use of three open-source Github Actions via the Github Marketplace to facilitate slash based workflows.
- peter-evans/slash-command-dispatch@v4 — for parsing slash commands and dispatching workflows
- myrotvorets/set-commit-status-action@master — for creating non-deployment commit statuses
- chrnorm/deployment-action@v2 — for creating deployment statuses
There are three slash commands available in this repository.
/deploy/remove/unlock
Note
Note that, although /remove corresponds to destroy_staging.yml, it is named in accordance with the SST command it triggers.
On any open PR, the slash commands will initiate their respective workflows.
Here is the expected sequence when using a slash command:
- User with
writeaccess submits a comment on a PR (e.g. "/remove") slash-command-dispatchdetects the comment as matching one of its enumerated commands and acknowledges with a reaction "👀"slash-command-dispatchdispatches the workflow and confirms with a reaction "🚀"- The workflow begins, either creating a deployment status (
deploy) viadeployment-actionor creating a commit status (destroy,unlock) viaset-commit-status-action, and sets the status to pending - The workflow executes
- Upon completion, both
deployment-actionandset-commit-status-actionwill update their respective statuses to either success or failure.