This gist aims to provide a simple solution for managing Heroku Review Apps with GitHub Actions due to the security incident that continues to disrupt Heroku's GitHub integration.
.github
├── workflows
│ ├── heroku_review_app_create.yml
│ └── heroku_review_app_destroy.yml
- Pull Request opened - create/update review app
- Pull Request reopened - create/update review app
- Pull Request synchronize (push) - update review app
- Pull Request closed - destroy review app
- actions/checkout
- akhileshns/heroku-deploy
- chrnorm/deployment-action
- chrnorm/deployment-status
- thollander/actions-comment-pull-request
Creates a Heroku Review App on PR open or reopen, also updates the Review App on any push to the PR
.github/workflows/heroku_review_app_create.yml
- Set dynamic env vars - Allows us to reuse/compose global env vars
- Check out PR code from GitHub
- Create GitHub deployment - Wire up the github deployment so links to
view deployment
are valid on the PR - Login to Heroku
- Create Heroku Review App
- Set Heroku Review App environment - Setup Heroku env vars (copy GitHub secrets etc...)
- Add Heroku Review App to pipeline
- Add Heroku git remote
- Push PR branch to Heroku
- Initialize the Heroku Review App database
- Migrate and seed the Heroku Review App database - Migrations must work and seeds must be idempotent
- Update deployment status on GitHub - Updates the PR with a link to the Review App deployment
.github/workflows/heroku_review_app_destroy.yml
- Set dynamic env vars - Allows us to reuse/compose global env vars
- Login to Heroku
- Destroy Heroku Review App
- Comment on PR
You'll need to configure your GitHub repo with the following Action secrets. NOTE: This is the minimal set.
HEROKU_API_KEY
- Your Heroku user's API keyHEROKU_EMAIL
- Your Heroku user's email addressRAILS_MASTER_KEY
-[optional]
The Rails master key used for encrypted credentials
This effort is sponsored by Orbit.love (mission control for your community).
