anthropics / anthropics/claude-code-action
validateBranchName rejects valid non-ASCII (e.g. Japanese) branch names
- Dominant language
- TypeScript
- Stars
- 8.9k
- Forks
- 2.1k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 10
Description
## Description
`validateBranchName` in `src/github/operations/branch.ts` uses a strict ASCII-only regex pattern:
```typescript
const validPattern = /^[a-zA-Z0-9][a-zA-Z0-9/_.-]*$/;
```
This rejects branch names containing non-ASCII characters (e.g. Japanese), even though Git and GitHub fully support them.
## Steps to Reproduce
1. Create a PR from a branch with a non-ASCII name (e.g. `feat/add-機能追加`)
2. Trigger any workflow using `claude-code-action@v1` on that PR
3. Action fails with:
```
Invalid branch name: "feat/add-機能追加". Branch names must start with an alphanumeric character and contain only alphanumeric characters, forward slashes, hyphens, underscores, or periods.
```
## Expected Behavior
The action should accept valid Git branch names containing non-ASCII characters (Unicode letters).
## Suggested Fix
Update the regex to allow Unicode letters while still blocking dangerous characters:
```typescript
const validPattern = /^[\p{L}\p{N}][\p{L}\p{N}/_.-]*$/u;
```
This maintains the security intent (blocking control characters, shell metacharacters, etc.) while supporting internationalized branch names.
Contributor guide
Assessment
This issue has not been assessed yet.