Skip to content

ci(release-plz): add fallback triggers for missed push events#203

Merged
hashedone merged 2 commits into
mainfrom
ci/fix-release-plz-triggers
May 26, 2026
Merged

ci(release-plz): add fallback triggers for missed push events#203
hashedone merged 2 commits into
mainfrom
ci/fix-release-plz-triggers

Conversation

@hashedone
Copy link
Copy Markdown
Contributor

Problem

The release-plz workflow uses on: push: branches: [main] as its only trigger. GitHub Actions sometimes fails to fire push events after rebase/squash merges of PRs — see community discussion #26657.

This bit us today: PR #200 was merged at 11:23 UTC, the push event was recorded by GitHub, but NO workflows fired (CI, CodeQL, Release-plz all silent). Manual workflow_dispatch returned HTTP 500. Result: release-plz never produced an updated release PR for the new agent-policies features, and we had to consider releasing manually.

This isn't the first time it's happened.

Fix

Add two fallback triggers:

  1. pull_request_target with type=closed, gated by github.event.pull_request.merged == true. This catches the merge directly without depending on the push event firing. Per the GitHub discussion linked above, this is the official workaround for missed push-after-merge events.

  2. Hourly schedule cron ('0 * * * *') as a final safety net. Even if both push and PR triggers fail, release-plz will run within an hour.

Both fallback triggers explicitly checkout main (ref: main on actions/checkout) so the workflow always operates on the right ref regardless of what triggered it. This is also a security best practice for pull_request_target — it ensures we never run untrusted code from a PR's HEAD.

Concurrency group is now keyed on a constant release-plz-main so all triggers share one slot instead of creating per-PR groups.

Notes

  • pull_request_target runs in the context of the target branch with secrets — safe here because the workflow checks out main and ignores PR content.
  • The if guard prevents the workflow running when a PR is closed without merge.
  • The job already has concurrency: { cancel-in-progress: false } so duplicate runs from multiple triggers will queue rather than clobber each other.

hashedone added 2 commits May 26, 2026 13:48
…k triggers

The 'on: push' trigger has been unreliable — GitHub sometimes does not
fire push events after rebase/squash merges of PRs. Repeatedly this has
left release-plz stuck on stale state until a manual nudge.

Add two fallbacks:
- pull_request_target with type=closed (gated by merged==true) catches
  the merge directly without depending on the push event firing.
- Hourly schedule cron is a final safety net — even if both push and
  PR triggers fail, release-plz will run within an hour.

Both fallback triggers explicitly checkout 'main' so the workflow always
operates on the right ref regardless of what triggered it (security
relevant for pull_request_target).

Concurrency group is now keyed on a constant 'release-plz-main' so all
triggers (push / pull_request_target / schedule / dispatch) share one
slot instead of creating per-PR groups.
@hashedone hashedone merged commit 88c8f33 into main May 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant