fix(statewrite): attribute state commits to the bot, not the token owner - #364
Merged
Merged
Conversation
State writes go through the GitHub Contents API, which stamps the commit with the token owner when no author or committer is set, so automated update-state commits carried the maintainer's name across every repo. Thread the configured git identity (GetGitUserName/GetGitUserEmail, defaulting to github-actions[bot] and overridable per repo via the manifest git config) into the PUT as both author and committer. Forward-looking only; existing history is unchanged. Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
joshua-temple
force-pushed
the
fix/state-commit-bot-attribution
branch
from
June 25, 2026 20:25
f8fa328 to
5299948
Compare
joshua-temple
enabled auto-merge (squash)
June 25, 2026 20: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.
Problem
Automated state-write commits (
chore: update state [skip ci], promotion, rollback) are attributed to the human token owner as both author and committer, across cascade and every fleet example repo. These writes go through the GitHub Contents API, which stamps the token owner when noauthor/committeris supplied. The git-based writers already setgithub-actions[bot]; the API path was the gap.Fix
Thread the configured git identity (
GetGitUserName/GetGitUserEmail, defaultgithub-actions[bot], overridable per repo via the manifestgitconfig) throughOptions.AuthorandContentsClient.PutContentinto thegh apiPUT as bothauthorandcommitter. Verified that gh nestsauthor[name]=into a JSON object, so attribution takes effect. Forward-looking only; existing history is untouched.Tests
TestCommitWithRetry_StampsBotAuthorAndCommitter(default, full override, partial override) andTestCommitWithRetry_IdentityPersistsAcrossRetries(identity accompanies both PUTs across a 409 retry).Verification
go build ./...; full
go test ./...(1780 pass);go test ./internal/statewrite/... -race; golangci-lint clean on touched packages.