Support attributing MassApplyPatch operations to a dedicated bot account#52
Merged
Conversation
Add a `BotAuth(; token, user_name, user_email)` struct and thread it through `make_patch_pr` via a new `auth` kwarg that also propagates to `clone_repo` (HTTPS clone with the token, local git user.name/email config) and `github_auth` (PAT for GitHub API calls). When `auth === nothing` (default), the existing behavior is preserved: SSH clone via the user's local key, the user's global git config for commit identity, and `gh auth token` / `ENV["GITHUB_AUTH"]` for the API. The intended use case is running MassApplyPatch under an automation account. Callers like ITensorOrgPatches can construct a `BotAuth` from a PAT stored in e.g. macOS Keychain and pass it in. The PAT is only ever present in a short-lived tmpdir clone URL; nothing is stored on disk beyond the caller's secret store. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #52 +/- ##
==========================================
- Coverage 24.63% 24.19% -0.44%
==========================================
Files 13 13
Lines 609 620 +11
==========================================
Hits 150 150
- Misses 459 470 +11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Mirrors the make_patch_pr signature so callers using the argv-style entrypoint can also attribute operations to a bot account. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Adds a
BotAuth(; token, user_name, user_email)struct and threads it throughmake_patch_prvia a newauthkwarg. The auth kwarg propagates to:clone_repo— clones via HTTPS with the PAT embedded in the URL (so the push authenticates as the token's owner) and setsgit config user.name/user.emailin the cloned repo to the bot identity.github_auth— uses the PAT for the GitHub API.When
auth === nothing(default), the existing behavior is preserved exactly: SSH clone via the user's local key, the user's global git config for commit identity, andgh auth token/ENV["GITHUB_AUTH"]for the API. No caller that omitsauthis affected.Intended use
Running MassApplyPatch under an automation account. A caller like ITensorOrgPatches can construct a
BotAuthfrom a PAT stored in e.g. macOS Keychain and pass it in:The PAT is only ever present in a short-lived tmpdir clone URL; nothing is stored on disk beyond the caller's own secret store.
Why kwargs instead of env vars
Earlier draft of this change used environment variables. Switched to kwargs so the API signature makes the bot-attribution contract explicit, and so callers can't accidentally leak credentials through process env into other tooling.
Compat
Pre-0.3 bump; call sites that omit
authcontinue to behave identically.