Why a merged pull request didn't start your deploy workflow
You merged a pull request and your deploy workflow, which runs on push to main, never started. Or an automation merged it and nothing happened. A common cause is a deliberate GitHub rule.
The rule
According to GitHub's documentation, events triggered by the repository's GITHUB_TOKEN generally do not create new workflow runs. The exceptions are workflow_dispatch and repository_dispatch. This stops a workflow from triggering itself in a loop.
How it bites
- A workflow merges a pull request with GITHUB_TOKEN. The push to main is an event caused by that token, so the deploy workflow does not run.
- A workflow opens or updates a pull request with that token. The resulting pull_request workflows may wait for approval from someone with write access, as GitHub's current docs describe.
- A rollback job pushes a revert with that token. The redeploy does not start.
The fixes
- Use a GitHub App installation token, or a personal access token, for the step that merges or pushes. Events from those do trigger workflows.
- Or trigger the deploy directly with workflow_dispatch from the same job.
- Or put the deploy in the same workflow, as a later job, instead of relying on a second workflow to start.
- Check Actions settings too: workflows can be disabled for the repository, or limited to certain actions.
How to check which case you have
- Open the Actions tab and look for a run for the merge commit. If there is none, the event did not fire.
- Check who made the merge. If it was a workflow using the default token, you are in the case above.
- Check that the workflow file has on: push with the right branch, and that it exists on the branch that was pushed to.
How Merge Scheduler behaves
Merge Scheduler merges with its own GitHub App identity, not your workflow's token, so your deploy workflow starts as if a person had pressed the button. It then looks for the runs triggered by that merge commit. If it finds none within the time you set, it tells you instead of assuming the deploy succeeded.
Do this in Merge Scheduler: Set up automatic revert for a failed deploy
Related: Why your auto-rollback job can't push the revert to main · How to schedule a GitHub pull request merge (4 ways) · GitHub auto-merge, merge queue and scheduled merge: what each is for