Context
Staging deployment must be completed sequentially.
Problem
- Before deploying to main, the PR owner needs to check if there is a staging deployment in progress (people often forget to do this)
- Tech lead needs to constantly monitoring the deployments to merge new PRs
Solution
Create a github workflow to simulate a PR merge queue.
- Trigger workflow when a PR has is ready (ready = PR is NOT a draft, it has been approved and passes all of the linting checks) & trigger workflow every 15/30 mins
- Workflow reads all of the open PRs and gets a list of all ready PRs, sorted by creation time (oldest ready PR should be merged first)
- Workflow pops the first PR from the queue.
- If there is a staging deployment in progress, return
- If the PR is up to date with main and there are no merge conflicts, merge it.
- If the PR is up to date with main and there are conflicts with main, convert the PR to a draft and ping the owner
- If the PR is not up to date with main and there are no conflicts, update it (if linting fails, convert the PR to draft and ping the owner), then merge it.
Context
Staging deployment must be completed sequentially.
Problem
Solution
Create a github workflow to simulate a PR merge queue.