Skip to content

Branch name validation rejects @ character which is valid in git #998

@msyed-godaddy

Description

@msyed-godaddy

Description

The branch name validation in src/github/operations/branch.ts rejects branch names containing @, even though @ is a valid character in git branch names. This causes the action to fail on PRs with @ in the branch name.

Steps to Reproduce

  1. Create a PR from a branch with @ in the name, e.g. TICKET-123@add-feature
  2. The Claude PR review workflow triggers
  3. The prepare step fails with:
    Prepare step failed with error: Invalid branch name: "TICKET-123@add-feature". 
    Branch names must start with an alphanumeric character and contain only alphanumeric characters, 
    forward slashes, hyphens, underscores, or periods.
    

Root Cause

The allowlist regex in src/github/operations/branch.ts:

const validPattern = /^[a-zA-Z0-9][a-zA-Z0-9/_.-]*$/;

Does not include @ in the allowed character set. While @{ is a special git reflog syntax (and is correctly rejected separately), a standalone @ or @ followed by non-{ characters is perfectly valid in git branch names.

Expected Behavior

Branch names containing @ (but not @{) should be accepted. The regex could be updated to:

const validPattern = /^[a-zA-Z0-9][a-zA-Z0-9/_.@-]*$/;

With the existing @{ check still catching the unsafe git reflog syntax.

Environment

  • Action version: v1.0.27
  • Event: pull_request

Impact

Any PR with @ in the branch name will fail the Claude review workflow. This is a common pattern in some teams (e.g. TICKET@description convention).

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