Summary
validateBranchName in src/github/operations/branch.ts rejects branch names containing +, but Claude Code's EnterWorktree tool automatically converts / in worktree names to + when generating branch names. This creates a compatibility issue where branches created via the standard Claude Code workflow fail CI when using claude-code-action.
Steps to Reproduce
- Use Claude Code's
EnterWorktree tool with a name containing /, e.g. feat/skill-consolidation
EnterWorktree generates the branch name worktree-feat+skill-consolidation (converts / → +)
- Open a PR from that branch
claude-code-action fails with:
Invalid branch name: "worktree-feat+skill-consolidation". Branch names must start with an
alphanumeric character and contain only alphanumeric characters, forward slashes, hyphens,
underscores, periods, or hashes (#).
Root Cause
The whitelist pattern in validateBranchName:
const validPattern = /^[a-zA-Z0-9][a-zA-Z0-9/_.#-]*$/;
does not include +, so branch names generated by EnterWorktree are rejected.
Why This Should Be Fixed
As noted in the code comments, all git calls use execFileSync (not shell interpolation), so + carries no command injection risk — the same argument made for allowing #:
All git calls use execFileSync (not shell interpolation), so # carries no injection risk.
The same logic applies to +. Git itself allows + in branch names, and since the execution is sandboxed via execFileSync, there is no security concern.
Proposed Fix
Add + to the whitelist pattern:
const validPattern = /^[a-zA-Z0-9][a-zA-Z0-9/_.#+\-]*$/;
Alternatively, fix EnterWorktree to use - instead of + when sanitizing worktree names — but since both tools are Anthropic products, fixing the validation in claude-code-action is the cleaner solution, as + is a valid and common character in branch names.
Environment
claude-code-action: v1 (latest)
- Claude Code CLI with
EnterWorktree tool
Summary
validateBranchNameinsrc/github/operations/branch.tsrejects branch names containing+, but Claude Code'sEnterWorktreetool automatically converts/in worktree names to+when generating branch names. This creates a compatibility issue where branches created via the standard Claude Code workflow fail CI when usingclaude-code-action.Steps to Reproduce
EnterWorktreetool with a name containing/, e.g.feat/skill-consolidationEnterWorktreegenerates the branch nameworktree-feat+skill-consolidation(converts/→+)claude-code-actionfails with:Root Cause
The whitelist pattern in
validateBranchName:does not include
+, so branch names generated byEnterWorktreeare rejected.Why This Should Be Fixed
As noted in the code comments, all git calls use
execFileSync(not shell interpolation), so+carries no command injection risk — the same argument made for allowing#:The same logic applies to
+. Git itself allows+in branch names, and since the execution is sandboxed viaexecFileSync, there is no security concern.Proposed Fix
Add
+to the whitelist pattern:Alternatively, fix
EnterWorktreeto use-instead of+when sanitizing worktree names — but since both tools are Anthropic products, fixing the validation inclaude-code-actionis the cleaner solution, as+is a valid and common character in branch names.Environment
claude-code-action: v1 (latest)EnterWorktreetool