Repository navigation
ci(pr): run the pull-request workflow on merge-group commits - #1597
Merged
Merged
Conversation
The merge queue builds a commit on gh-readonly-queue/develop/... and asks for the required checks on it, but nothing listened for merge_group, so Build and test never reported and every queue entry timed out. Trigger on merge_group (checks_requested), key the concurrency group on the queue ref, treat the run as a ready pull request (full tier) over base_sha..head_sha of the merge group, and give the protobuf baseline and the version stamp a merge-group branch. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
The test fails on the workflow before this branch (no trigger, one concurrency key, pull-request-only reads) and passes with it. CONTRIBUTING.md says how the merge queue runs the full tier on the queue commit, with a changelog fragment. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
The develop ruleset requires the checks
Changed areasandBuild and test, both produced by.github/workflows/pr.yml. With a merge queue on the branch, GitHub builds a commit onrefs/heads/gh-readonly-queue/develop/pr-<n>-<base-sha>for each enqueued pull request and asks for the required checks on it through themerge_groupevent — butpr.ymlonly listened forpull_request, so nothing ran on the queue commit, nothing reported, and the entry sat until the status-check timeout dequeued it as failed (PR #1580: queue commit created, no workflow run).pr.ymlnow triggers onmerge_group(checks_requested) as well, and every place that read the pull-request payload has a merge-group branch:merge-group-<ref>for a queue commit (each entry has its own ref) andpr-<number>for a pull request;Changed areastreats a queue commit as a ready pull request —DRAFTand theci:fulllabel are both false, so the full tier runs — and computes the areas from the merge group's own diff,merge_group.base_sha..merge_group.head_sha, through the samescripts/ci-changed-areas.sh, so a queue commit gets exactly the checks a ready pull request with the same diff gets;base_ref(refs/heads/develop, stripped to the branch name) where a pull request usesgithub.base_ref;VERSION=merge-queue(with the commit) instead ofpr-<number>.Build and teststays the single aggregate (if: always(), sameneeds) and reports on the queue commit.The other workflows were audited: the ruleset's required checks are exactly the two
pr.ymlemits, and no other workflow gates pull requests, so none of them changes.Also:
tests/hygiene/merge_group_workflow_test.goholds the workflow to the trigger, the merge-group branches ofChanged areas(diff range and draft flag), the two concurrency-group forms and the unconditional aggregate;CONTRIBUTING.mdgains a paragraph on the queue next to the quick/full tier description; changelog fragmentchanges/unreleased/merge-group-ci.changed.md.The merge queue is currently switched off in the develop ruleset. The change is inert while it is off and removes the stall if the queue is re-enabled.
How it was verified
actionlint .github/workflows/pr.yml: no finding introduced. The two it reports (shellcheck SC2129 style, SC2034 warning) are in untouchedrun:blocks and are reported identically on develop.go test ./tests/hygiene -run TestPRWorkflow→ok. Against develop'spr.yml(the test file alone checked out overorigin/develop) the five tests fail: nomerge_grouptrigger, pull-request-only concurrency key, unguardedDRAFT/label reads, no merge-group diff range, unguarded payload reads.go build ./... && go vet ./... && gofmt -l .→ clean,gofmt -l .empty.python3 scripts/changelog.py checkpasses.changesjob's shell for the merge_group case: the tier step withDRAFT=false CI_FULL_LABEL=falseyieldstier=full; a queue-shaped commit (origin/developmerged with this branch in a detached worktree) run throughscripts/ci-changed-areas.sh <base_sha> <head_sha>withCI_TIER=fullproduced the same area outputs (go_shards=["runtime","runtime-corpus","model","export","graph","codegen","rest","migrate","cli"], …) as the pull-request formscripts/ci-changed-areas.sh origin/develop HEADon this branch — byte-identical.What this PR could not test
A real
merge_grouprun cannot be triggered from this pull request: the queue runs the workflow that is ondevelop, and this is the change that makesdevelop's workflow listen. After merging, and once the queue is on again, enqueue a trivial pull request and confirm aPRworkflow run appears for thegh-readonly-queue/develop/pr-<n>-...ref withChanged areasandBuild and testreporting on the queue commit.Ruleset settings to make when re-enabling the queue (GitHub UI, no CLI): repository Settings → Rules → Rulesets → develop → Require merge queue. Keep the required status checks exactly
Changed areasandBuild and test, and set Status check timeout to at least 120 minutes — of the last 40 greenpr.ymlruns, 10 exceeded 60 minutes (longest 92), so the previous 60-minute timeout would dequeue slow-but-passing entries as failed.Checklist
make testandmake lintpass locally (go build,go vet,gofmt -l, the hygiene suite; CI runs the rest)changes/unreleased/<slug>.<section>.md, not as an edit toCHANGELOG.mdLink to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/41bd27e6714f4b5ca3c4fac9f92bb1fb
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/41bd27e6714f4b5ca3c4fac9f92bb1fb?variant=devin
Requested by: @HuiJun