ci: auto-merge Fern regeneration PRs once required checks pass - #65
Merged
Conversation
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
marked this pull request as ready for review
August 24, 2026 23:25
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.
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?
.github/workflows/auto-merge.yml, byte-identical to the copy already live onwhopio/whopsdk-typescriptmain. Onpull_request_target, a PR opened byfern-api[bot](user id115122769) from an in-repofern-bot/*branch against the default branch is approved withsecrets.GITHUB_TOKENand then armed withgh pr merge --auto --squash. The job checks nothing out, which is what makespull_request_targetsafe here; the trigger ispull_request_targetrather thanpull_requestso the workflow that arms a PR is always the copy on the base branch, never the copy the PR carries.Approvestep exists because GitHub Actions cannot be added as a ruleset bypass actor — the API rejects it with422 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 becausecan_approve_pull_request_reviewsis enabled on the repo..fernignore. Fern reads.fernignorefrom 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):compileandtestcome fromci.yml'spushtrigger,decideandbuildfrompublish-main.yml'spull_requesttrigger.buildfailed on #57 against the pre-#58 version-stamp regex, which #58 fixed; everypull_requestrun ofbuildsince has passed, including on this branch.