Skip to content

validateBranchName rejects valid non-ASCII (e.g. Japanese) branch names #1020

@HayashidaShun

Description

@HayashidaShun

Description

validateBranchName in src/github/operations/branch.ts uses a strict ASCII-only regex pattern:

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp2Non-showstopper bug or popular feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions