Skip to content

ci: auto-merge Fern regeneration PRs once required checks pass - #65

Merged
antonwhop merged 2 commits into
mainfrom
anton/arm-auto-merge-for-fern-prs
Aug 24, 2026
Merged

ci: auto-merge Fern regeneration PRs once required checks pass#65
antonwhop merged 2 commits into
mainfrom
anton/arm-auto-merge-for-fern-prs

Conversation

@antonwhop

@antonwhop antonwhop commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Why

Fern's SDK regeneration PRs sit unmerged until a human clicks merge; this makes them merge themselves once the required checks pass.

What changed?

  • Adds .github/workflows/auto-merge.yml, byte-identical to the copy already live on whopio/whopsdk-typescript main. On pull_request_target, a PR opened by fern-api[bot] (user id 115122769) from an in-repo fern-bot/* branch against the default branch is approved with secrets.GITHUB_TOKEN and then armed with gh pr merge --auto --squash. The job checks nothing out, which is what makes pull_request_target safe here; the trigger is pull_request_target rather than pull_request so the workflow that arms a PR is always the copy on the base branch, never the copy the PR carries.
  • The Approve step exists because GitHub Actions cannot be added as a ruleset bypass actor — the API rejects it with 422 Actor GitHub Actions integration must be part of the ruleset source or owner organization. So the workflow satisfies the ruleset's one required review instead of bypassing it. This works because can_approve_pull_request_reviews is enabled on the repo.
  • Adds the workflow to .fernignore. Fern reads .fernignore from the PR's base branch, so the entry only protects the file once this lands.

Checks

All four required contexts report on a real Fern PR, verified on #57 (fern-bot/2026-08-22_07-37-53_691): compile and test come from ci.yml's push trigger, decide and build from publish-main.yml's pull_request trigger. build failed on #57 against the pre-#58 version-stamp regex, which #58 fixed; every pull_request run of build since has passed, including on this branch.

antonwhop and others added 2 commits August 24, 2026 13:56
Adds a pull_request_target workflow that enables squash auto-merge for pull
requests opened by fern-api[bot] from an in-repo fern-bot/* branch, and lists
it in .fernignore so a regeneration cannot prune it.
GitHub Actions cannot be added as a ruleset bypass actor, so the arming
workflow satisfies the required review instead of bypassing it.
@antonwhop antonwhop changed the title ci: arm auto-merge on Fern regeneration PRs ci: auto-merge Fern regeneration PRs once required checks pass Aug 24, 2026
@antonwhop
antonwhop marked this pull request as ready for review August 24, 2026 23:25
@antonwhop
antonwhop merged commit 77fdba6 into main Aug 24, 2026
7 checks passed
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