Skip to content

Use gh pr merge --auto so the nightly bot waits for required checks - #1302

Closed
escherize wants to merge 1 commit into
masterfrom
automerge-for-branch-protection
Closed

Use gh pr merge --auto so the nightly bot waits for required checks#1302
escherize wants to merge 1 commit into
masterfrom
automerge-for-branch-protection

Conversation

@escherize

Copy link
Copy Markdown
Collaborator

Why

We want branch protection on master (see Slack discussion). The blocker is the nightly docs build: it opens its own PR and immediately merges it with gh pr merge --squash, without waiting for checks. With a required "Test Docs Build" check, that immediate merge would fail every night.

What

script/merge.clj now tries gh pr merge --auto first. With branch protection enabled, GitHub queues the merge and completes it once required checks pass. If --auto errors (auto-merge unavailable — the current state, since master has no protection yet), it falls back to the old immediate merge.

The fallback makes this safe to merge before protection is flipped on: behavior tonight is identical to today.

Rollout

After this merges, enabling protection is settings-only:

  1. Repo setting: enable "Allow auto-merge".
  2. Ruleset on master: require PRs, require the "Test Docs Build" check, block force pushes, 0 required approvals (the bot can't approve its own PR).

Validation

  • Repo test suite passes locally (bb script/_test/all.clj, 38 assertions).
  • After merge, verify via a manual "Update Docs" workflow dispatch — see PR comments for steps.

With branch protection on master, an immediate merge fails while the
Test Docs Build check is still pending. --auto queues the merge until
required checks pass. Falls back to an immediate merge when auto-merge
is unavailable (ie. before branch protection is enabled), so this is
safe to land in either order.
@escherize

Copy link
Copy Markdown
Collaborator Author

Verification steps:

Stage 1 — this PR: the "Test Docs Build" check on this PR proves the script still parses and the site builds.

Stage 2 — after merge, before protection (fallback path):

gh workflow run update-docs-base-bun.yml -f major_versions=63

In the run's "Merge Updated Docs" step logs, expect Auto-merge unavailable (...), merging directly... followed by ✓ PR merged successfully!. That confirms tonight's nightly behaves exactly as before.

Stage 3 — after enabling "Allow auto-merge" + the master ruleset (auto path): dispatch the same workflow. The logs should show no fallback message, the docs-update PR should show "Auto-merge enabled", and it should merge on its own once Test Docs Build passes:

gh pr view <docs-update-pr-number> --json autoMergeRequest,state

@escherize
escherize requested a review from iethree August 26, 2026 20:55

@iethree iethree left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is helpful, but we have a github actions native way to handle this. will submit another pr

@escherize escherize closed this Aug 26, 2026
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