This is a Heroku Buildpack you can add to your Heroku deployments that will notify a Slack channel every time your application is deployed.
heroku labs:enable runtime-dyno-metadata
heroku config:set SLACK_DEPLOYMENT_WEBHOOK_URL="https://hooks.slack.com/services/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S"
heroku buildpack:set command will replace any buildpacks you already have).
By default, there's very little information about the commit that we can get from Heroku. However, we can curl the Github API and try to learn more about the commit. If you set the following additional environment variables, we can load the commit information, committer, and URL from Github:
DEPLOY_NOTIFY_GITHUB_AUTH_TOKEN: A Github PAT Token. You can generate one here
Important note: you must grant repo access when creating this PAT Token, or else it will default to "Public Access" and won't work!
DEPLOY_NOTIFY_GITHUB_ORG: The name of your Github Org (or Github User Name)
DEPLOY_NOTIFY_GITHUB_PROJECT: The name of your Github Project (i.e. repository name)
Now, the message in Slack can look like:
*my-heroku-app* was deployed - Deploy 04a2729b
> Evan Tahler - email@example.com
> Fix all the bugs and make everything great
Copy the snippet above into CLI.