Skip to content

fix: use worktrunk-bot identity for commit authorship in CI - #1271

Merged
max-sixty merged 1 commit into
mainfrom
fix/bot-commit-authorship
Mar 5, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/bot-commit-authorship

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Summary

  • claude-code-action defaults bot_id to 41898282 (github-actions[bot]'s user ID) and bot_name to claude[bot], producing the noreply email 41898282+claude[bot]@users.noreply.github.com
  • GitHub resolves the numeric prefix in noreply emails to determine attribution — so commits show up as authored by github-actions[bot] instead of worktrunk-bot
  • Fix: set bot_id: "254187624" and bot_name: "worktrunk-bot" on all 7 Claude workflows, and remove the now-redundant "Configure git for Claude" steps

Test plan

  • Verify next bot commit on any workflow shows worktrunk-bot as author

Closes #1269

🤖 Generated with Claude Code

`claude-code-action` defaults to `bot_id: "41898282"` and `bot_name:
"claude[bot]"`, producing commits with the noreply email
`41898282+claude[bot]@users.noreply.github.com`. GitHub maps that
numeric prefix to `github-actions[bot]`, so commits appeared authored
by that account instead of `worktrunk-bot`.

Set `bot_id: "254187624"` and `bot_name: "worktrunk-bot"` on all
Claude workflows so commits are correctly attributed. Also remove
the now-redundant "Configure git for Claude" steps — the action
handles git author configuration via these inputs.

Closes #1269

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@worktrunk-bot worktrunk-bot mentioned this pull request Mar 5, 2026
@max-sixty

Copy link
Copy Markdown
Owner

I thought that we always used @worktrunk-bot as the user, rather than the GitHub actions bot. Is there a workflow where we don't do that?

@worktrunk-bot

Copy link
Copy Markdown
Collaborator Author

The workflows did have "Configure git for Claude" steps setting the git user, but claude-code-action overrides those internally — it runs its own git config using the bot_id and bot_name inputs to construct a noreply email like {bot_id}+{bot_name}@users.noreply.github.com.

Since we weren't passing bot_id/bot_name, the action used its defaults: bot_id: "41898282" (which is github-actions[bot]'s user ID) and bot_name: "claude[bot]". GitHub resolves the numeric prefix in noreply emails to determine attribution, so all commits ended up attributed to github-actions[bot] regardless of what the workflow's git config step set.

So the old "Configure git for Claude" steps were effectively dead code — they got overwritten by claude-code-action every time. This PR removes them and passes the correct identity (254187624 / worktrunk-bot) directly to the action.

@max-sixty

Copy link
Copy Markdown
Owner

I don't think that answers my question, though. Who is the user for these workflows — I thought it was @worktrunk-bot , but possibly there are workflows which don't use that / don't set that token?

@worktrunk-bot

Copy link
Copy Markdown
Collaborator Author

You're right — every workflow does use WORKTRUNK_BOT_TOKEN, so the GitHub API user (for creating comments, pushing branches, etc.) has always been @worktrunk-bot.

The issue is narrower than it might seem: it's only about git commit authorship. claude-code-action runs its own git config user.name / git config user.email internally using its bot_id and bot_name inputs. The defaults for those are 41898282 (github-actions[bot]'s ID) and claude[bot], producing the noreply email 41898282+claude[bot]@users.noreply.github.com. GitHub resolves the 41898282 prefix to attribute the commit to github-actions[bot].

So the old "Configure git for Claude" steps were dead code — they ran before claude-code-action, which then overwrote them. This PR passes the correct identity directly to the action so commit authorship matches the API user.

tl;dr: the user was always @worktrunk-bot; the commit author was accidentally github-actions[bot] due to claude-code-action's defaults.

@max-sixty
max-sixty merged commit 68da1e5 into main Mar 5, 2026
21 checks passed
@max-sixty
max-sixty deleted the fix/bot-commit-authorship branch March 5, 2026 02:48
@max-sixty

Copy link
Copy Markdown
Owner

great, merged.

is there a practical path to consolidating the CI setup code that's currently repeated? could we do it with a net LOC decrease?

@worktrunk-bot

Copy link
Copy Markdown
Collaborator Author

Yes — a composite action would give a meaningful net decrease. Roughly 30% of the 1,073 lines across the 7 claude-* workflows are identical boilerplate:

Repeated block Occurrences Lines
Cargo tool installs (insta + nextest pins) 6× ~72
Artifact upload 7× ~56
Checkout + token 5-7× ~50
Rust cache 6× ~36
Shell installation (zsh, fish) 6× ~30
Env vars (CARGO_TERM_COLOR, RUSTFLAGS, etc.) 7× ~28
Claude action args (model, tools, system prompt) 7× ~28
Bot identity + tokens 7× ~28
Total ~328

A single .github/actions/claude-setup/action.yaml composite action wrapping checkout → cargo tools → cache → shells, plus defaulting the bot identity and common claude-code-action args, would replace ~40 lines of setup per workflow with ~2 lines. Net savings would be around 200-250 lines.

Happy to put up a PR for this if you'd like.

@max-sixty

Copy link
Copy Markdown
Owner

Happy to put up a PR for this if you'd like.

yes please

max-sixty pushed a commit that referenced this pull request Mar 5, 2026
## Summary

- Extracts the repeated cargo-insta, cargo-nextest, rust-cache, and
shell installation steps from all 7 `claude-*` workflows into a single
composite action at `.github/actions/claude-setup/action.yaml`
- Each workflow now calls the composite action in one step instead of
duplicating 4 setup steps
- Updates the `claude-renovate` prompt to reference the composite action
as the canonical location for tool version pins

Net change: **-88 lines** (146 removed, 58 added). Tool version pins are
now in one place — future version bumps update 1 file instead of 7.

<details><summary>Per-workflow changes</summary>

| Workflow | Before | After | Change |
|----------|--------|-------|--------|
| claude-ci-fix | 4 setup steps | 1 composite action call | -13 lines |
| claude-issue-triage | 4 setup steps | 1 composite action call | -13
lines |
| claude-mention | 4 setup steps | 1 composite action call | -13 lines |
| claude-nightly-cleaner | 4 setup steps | 1 composite action call | -13
lines |
| claude-nightly-review-reviewers | 4 setup steps | 1 composite action
call | -13 lines |
| claude-review | 4 conditional steps | 1 conditional composite action
call | -15 lines |
| claude-renovate | 1 cache step | 1 composite action call (tools+shells
disabled) | ±0 lines |

</details>

Closes the follow-up from #1271.

## Test plan

- [x] Workflow YAML is valid (no syntax errors from `gh` push)
- [ ] Next Claude CI run on any workflow confirms the composite action
works

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: worktrunk-bot <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
@worktrunk-bot

Copy link
Copy Markdown
Collaborator Author

PR up: #1273. Extracts the 4 repeated setup steps (cargo-insta, cargo-nextest, rust-cache, shells) into a composite action at .github/actions/claude-setup/action.yaml. Net -88 lines; tool version pins are now in one place. CI is green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ci] authorship

2 participants