Repository navigation
feat(eve): credit the GitHub App on pull requests and commits made with a user's token - #270
Merged
Merged
Conversation
…th a user's token
With actAs 'user', or 'caller' and a signed-in user, GitHub records the
person as the author of what the agent writes. The extension now credits
the App by default: createPullRequest ends the body with a "Generated by"
line linking the App, and the commit tools add the App's bot account to
coAuthors with the noreply address GitHub links to it.
The App is read from the user's token through GET /user/installations,
once per process and connector. Calls that run as the App add nothing.
`attribution: false` turns both credits off, `{ footer, coAuthor }` picks.
The SDK exports githubAppBot, githubAppBotIdentity, withGithubAppFooter
and GITHUB_COMMIT_TOOLS from eve-runtime, and adds APP_BOT_UNKNOWN.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Thank you for following the naming conventions! 🙏 |
Merged
Merged
1 of 2 tasks
This branch was successfully 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.
🔗 Linked issue
No GitHub issue. It came up while running Evi, evlog's eve agent: a pull request Evi opened from a Slack request listed the maintainer as its only author, with nothing saying the agent wrote it.
📚 Description
With
actAs: 'user', or'caller'and a signed-in user, each call runs with the person's own GitHub token, so GitHub records them as the author of whatever the agent writes. That stays as it is: the person who asked owns the change. The extension now credits the GitHub App alongside them, by default:createPullRequestends the pull request body withGenerated by [<app>](https://github.com/apps/<app>).createOrUpdateFile,editFiles,mergePullRequestandenablePullRequestAutoMergeadd the App's bot account tocoAuthors, using theid+<app>[bot]@users.noreply.github.comaddress GitHub links to the bot.Calls that run with the App's token add nothing, because GitHub already shows the App as their author.
Usage
Pull request body, for a user-token
createPullRequestwithbody: 'Fixes the drain.'Commit message, for a user-token
createOrUpdateFilewithmessage: 'docs: update readme'Both blocks are the texts the stubbed GitHub received in
tests/eve-act-as, recorded by the eval.How the App is found. No config is needed. GitHub lists only the issuing App's installations to a user access token, so
GET /user/installationsgives the App's slug, andGET /users/<slug>[bot]gives the bot's id. The lookup runs once per process and connector, inside the sametryas the call, so a revoked token still sends the user back through sign-in. A user token with no installation listed fails with the newgithub_tools.APP_BOT_UNKNOWN.SDK exports from
@github-tools/sdk/eve-runtime:githubAppBot(token),githubAppBotIdentity(bot),withGithubAppFooter(body, bot),GITHUB_COMMIT_TOOLS, and theGithubAppBottype.For reviewers
'user'or'caller'get the footer on new pull requests after upgrading, so the changeset is aminorbump for both packages and says how to turn it off.Co-authored-by, for example on evloghq/evlog#1027. The docs say so.updatePullRequestnever stacks a second one.Verification
pnpm build,pnpm lint,pnpm typecheckandpnpm testexit 0. The new vitest filepackages/github-tools/src/core/attribution.test.tshas 5 cases. The act-as eval gained these checks: a signed-in user's pull request and commit carry the credits, the App is looked up once, and neither a call that runs as the App nor a mount withattribution: falseadds anything.Not tested against real GitHub. The
/user/installationsroute is checked only against the stub.📝 Checklist
ELI5: When someone asks the agent to open a pull request, GitHub shows that person as the author, which is right, since they asked for it. Now the pull request also says at the bottom that the agent's App wrote it, and the commits list the App's bot as a co-author.