Skip to content

fix(statewrite): attribute state commits to the bot, not the token owner - #364

Merged
joshua-temple merged 1 commit into
mainfrom
fix/state-commit-bot-attribution
Jun 25, 2026
Merged

joshua-temple merged 1 commit into
mainfrom
fix/state-commit-bot-attribution

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

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 no author/committer is supplied. The git-based writers already set github-actions[bot]; the API path was the gap.

Fix

Thread the configured git identity (GetGitUserName/GetGitUserEmail, default github-actions[bot], overridable per repo via the manifest git config) through Options.Author and ContentsClient.PutContent into the gh api PUT as both author and committer. Verified that gh nests author[name]= into a JSON object, so attribution takes effect. Forward-looking only; existing history is untouched.

Tests

TestCommitWithRetry_StampsBotAuthorAndCommitter (default, full override, partial override) and TestCommitWithRetry_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.

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
joshua-temple force-pushed the fix/state-commit-bot-attribution branch from f8fa328 to 5299948 Compare June 25, 2026 20:25
@joshua-temple
joshua-temple enabled auto-merge (squash) June 25, 2026 20:25
@joshua-temple
joshua-temple merged commit e6a8d11 into main Jun 25, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant