Skip to content

[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
amd-stagingfrom
amd/infra/vkallesh/enable-automerge
Open

[CI] Fix merge-main-into-amd-staging workflow to actually land sync PRs (gated admin merge)#3038
vkallesh wants to merge 2 commits into
amd-stagingfrom
amd/infra/vkallesh/enable-automerge

Conversation

@vkallesh

@vkallesh vkallesh commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

The merge-main-into-amd-staging workflow 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

  • Native auto-merge (--auto) was not working as the branch ruleset
    block-merge-commit-on-amd-*-branches enforces
    required_linear_history on refs/heads/amd-* (which matches
    amd-staging), and that forbids merge commits. These sync PRs must
    land as merge commits.
  • GitHub rulesets are only bypassed by actors on the ruleset's Bypass
    list
    — admin privilege alone does not bypass a ruleset.

Changes

  • Require all mandatory gating checks to conclude success before
    merging (polls the 3 required check-runs; only success counts as
    passing — skipped/neutral no longer pass).
  • Require an approving review (reviewDecision == APPROVED) before
    merging.
  • Bump permissions to contents: write / pull-requests: write and add
    failure diagnostics around the merge step.
  • Update the header/comments to document the ruleset bypass requirement.
  • Scope is unchanged: same-repo, non-draft PRs titled
    "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-*-branches ruleset
(bypass mode: "For pull requests only"). Without this, the merge will
still be rejected by the ruleset.

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.
@vkallesh vkallesh requested a review from skganesan008 June 24, 2026 01:23
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