Skip to content

docs: safe admin merge procedure — disable auto-merge first#84

Closed
microsasa wants to merge 1 commit intomainfrom
docs/safe-admin-merge-procedure
Closed

docs: safe admin merge procedure — disable auto-merge first#84
microsasa wants to merge 1 commit intomainfrom
docs/safe-admin-merge-procedure

Conversation

@microsasa
Copy link
Owner

Documents the race condition discovered in issue #83 where disabling enforce_admins allows auto-merge PRs to merge without required approvals.

Updated the admin merge workaround in docs/agentic-workflows.md with the safe procedure:

  1. Disable auto-merge on all other open PRs
  2. Disable enforce_admins
  3. Admin merge
  4. Re-enable enforce_admins
  5. Re-enable auto-merge on those PRs

Refs #83

Document the race condition where disabling enforce_admins allows
auto-merge PRs to merge without required approvals (issue #83).
Updated the admin merge workaround with steps to disable/re-enable
auto-merge on other PRs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 15, 2026 18:17
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the solo-repo “admin merge workaround” documentation to avoid a race condition where temporarily disabling enforce_admins can allow other auto-merge-enabled PRs to merge without required approvals.

Changes:

  • Adds a step to disable auto-merge on other open PRs before disabling enforce_admins.
  • Documents a safer step-by-step sequence (disable auto-merge → disable enforce_admins → admin merge → re-enable enforce_admins → restore auto-merge).
  • Adds an explicit warning describing the observed failure mode (refs issue #83 / PR #69).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +365 to +382
# 1. FIRST: Disable auto-merge on all other open PRs (CRITICAL — race condition, see #83)
for pr in $(gh pr list --state open --json number,autoMergeRequest --jq '.[] | select(.autoMergeRequest != null) | .number'); do
gh pr merge --disable-auto "$pr"
done

# 2. Temporarily disable enforce_admins
gh api repos/OWNER/REPO/branches/main/protection/enforce_admins -X DELETE

# Admin merge
# 3. Admin merge
gh pr merge <PR> --merge --admin --delete-branch

# Re-enable
# 4. Re-enable enforce_admins
gh api repos/OWNER/REPO/branches/main/protection/enforce_admins -X POST

# 5. Re-enable auto-merge on those PRs
for pr in <saved list>; do
gh pr merge --enable-auto --merge "$pr"
done
Comment on lines +370 to 377
# 2. Temporarily disable enforce_admins
gh api repos/OWNER/REPO/branches/main/protection/enforce_admins -X DELETE

# Admin merge
# 3. Admin merge
gh pr merge <PR> --merge --admin --delete-branch

# Re-enable
# 4. Re-enable enforce_admins
gh api repos/OWNER/REPO/branches/main/protection/enforce_admins -X POST
@microsasa
Copy link
Owner Author

Rolling this into a larger pipeline improvements PR.

@microsasa microsasa closed this Mar 15, 2026
@microsasa microsasa deleted the docs/safe-admin-merge-procedure branch March 15, 2026 18:54
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.

2 participants