Repository navigation
feat!: let the person who approves a pull request open it as themselves - #110
Draft
electric-gizzard wants to merge 2 commits into
Draft
electric-gizzard wants to merge 2 commits into
electric-gizzard wants to merge 2 commits into
Conversation
GitHub credits a squash merge to whoever opened the pull request and adds the commits' authors as co-authors. Shuttle opened every pull request as its GitHub App and set the approver as the commits' author, so a squash landed on main as the App with the person as co-author: the wrong way round. Published commits are the App's again (no author is sent, so GitHub credits and signs them as the App). The publish card has an "Open as" choice between the approver and Shuttle, starting on the approver when their GitHub account is connected. The pull request is then opened with their own token, through the new githubPeople port, which Shuttle's own Worker fills from the tokens its sign-in keeps. Someone who chose themselves and cannot be acted as, or whom GitHub refuses, gets the reason: the App never opens it in their place. An approval the host's policy decided is always opened by the App. GITHUB_TOKEN and GitAccess.userToken() are no longer tried when the App is refused opening a pull request, so local development opens pull requests the way production does. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
This branch has not been deployed
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
GitHub credits a squash merge to whoever opened the pull request, and adds the commits' authors as
Co-authored-by. Shuttle opened every pull request as its GitHub App and (since #36) set the approver as the commits' author. So a squash landed onmainauthored by the App with the person as co-author, which is the wrong way round. #81 shows the same rule with another bot.What changes
Co-authored-bythe App when the opener is a personapprovedByplumbing, which is now who "you" is.GITHUB_TOKENandGitAccess.userToken()are no longer tried when the App is refused opening a pull request. They stay as a fallback for reading pull requests.githubPeople(tokenOf(userId)). Shuttle's Worker fills it from Better Auth's stored GitHub tokens, looked up by user id inside the run. A host without it gets the App for every pull request, as before.GET /sessions/{id}/pull-request/openertells the card who the person asking is on GitHub.Not included
Testing
bun run verifypasses (types, tests, lint, format), andbun run check:package.open-pull-request.test.ts: which token each GitHub call is made with, for the App, the person, a person with no account, a person GitHub refuses, and the dropped host-wide fallback; a commit sends no author or committer.publish-opener.test.ts: every combination of choice, approver and connection, including policy approvals and a host with nogithubPeople.user-token.test.ts: the per-user token lookup against a real Better Auth instance with no request.mirror-stack.test.ts,publish-effects.test.ts,pull-request-opener.test.ts: the choice travels from the card to the open call.🤖 Generated with Claude Code