[CI] Fix merge-main-into-amd-staging workflow to actually land sync PRs (gated admin merge)#3038
Open
vkallesh wants to merge 2 commits into
Open
[CI] Fix merge-main-into-amd-staging workflow to actually land sync PRs (gated admin merge)#3038vkallesh wants to merge 2 commits into
vkallesh wants to merge 2 commits into
Conversation
The merge-main-into-amd-staging workflow could never land its merge commits: it called `gh pr merge --merge --auto --admin`, but `--auto` and `--admin` are mutually exclusive in the gh CLI, so the command errored on every run. Even with that fixed, native auto-merge can't work here because the `block-merge-commit-on-amd-*-branches` ruleset enforces required_linear_history on amd-staging, which forbids merge commits. Rework the job to do the gating itself and then perform a direct admin merge: - Merge with `gh pr merge --merge --admin` (drop the illegal `--auto`). - Require all mandatory gating checks to conclude success (poll the 3 required check-runs; treat only `success` as passing). - Require an approving review (reviewDecision == APPROVED) before merging. - Scope unchanged: same-repo, non-draft PRs titled "merge main into amd-staging" targeting amd-staging. - Raise permissions to contents/pull-requests: write and add failure diagnostics for the merge step. - Update header/comments to document that admin privilege does NOT bypass a ruleset: the ROCM_CCIAPP App must be added to the ruleset's Bypass list (one-time repo config) for the merge commit to land.
…ATING_CHECKS variable
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.
Summary
The
merge-main-into-amd-stagingworkflow was never able to merge the"merge main into amd-staging" sync PRs. This PR reworks it to gate on the
mandatory checks + approval itself and then perform a direct admin merge.
Background / Why it was broken
--auto) was not working as the branch rulesetblock-merge-commit-on-amd-*-branchesenforcesrequired_linear_historyonrefs/heads/amd-*(which matchesamd-staging), and that forbids merge commits. These sync PRs mustland as merge commits.
list — admin privilege alone does not bypass a ruleset.
Changes
successbeforemerging (polls the 3 required check-runs; only
successcounts aspassing —
skipped/neutralno longer pass).reviewDecision == APPROVED) beforemerging.
contents: write/pull-requests: writeand addfailure diagnostics around the merge step.
"merge main into amd-staging" targeting
amd-staging.Required repo configuration (one-time, outside this PR)
For the merge commit to land, the ROCM_CCIAPP GitHub App must be added
to the Bypass list of the
block-merge-commit-on-amd-*-branchesruleset(bypass mode: "For pull requests only"). Without this, the merge will
still be rejected by the ruleset.