anthropics / anthropics/claude-code-action

Parser error with variable substitution in bash script analysis

Abierto
#888 0 comentarios 0 reacciones 0 asignados Ver en GitHub
bug p2 provider:1p
Lenguaje dominante
TypeScript
Estrellas
8.9k
Forks
2.1k
Merge medio
3 d 9 h
PR fusionados (30 d)
10

Descripción

**Describe the bug**
The Claude Code SDK fails to parse valid bash syntax during script analysis in GitHub Actions, throwing a "Bad substitution: all_badges:+" error. The same bash code
works perfectly when executed locally.

**To Reproduce**
Steps to reproduce the behavior:

1. Create a bash script with this variable assignment:
```bash
all_badges="${ready_for_approval_badge} ${all_badges}"
2. Set up a GitHub Action workflow using anthropics/claude-code-action@v1
3. Configure Claude to review the code
4. Run the workflow
5. See error: Error: Bad substitution: all_badges:+

Expected behavior
The SDK should successfully parse this valid bash syntax. The expression all_badges="${ready_for_approval_badge} ${all_badges}" is standard bash variable expansion
and should not cause parsing errors.

Screenshots
Error: Bad substitution: all_badges:+
at P (/home/runner/work/_actions/anthropics/claude-code-action/v1/base-action/node_modules/@anthropic-ai/claude-agent-sdk/cli.js:66:3347)
at (/home/runner/work/_actions/anthropics/claude-code-action/v1/base-action/node_modules/@anthropic-ai/claude-agent-sdk/cli.js:66:4002)
at map (native:1:11)
at u1K (/home/runner/work/_actions/anthropics/claude-code-action/v1/base-action/node_modules/@anthropic-ai/claude-agent-sdk/cli.js:66:3089)
...
Error: Failed to parse command: Bad substitution: all_badges:+
at BB1 (/home/runner/work/_actions/anthropics/claude-code-action/v1/base-action/node_modules/@anthropic-ai/claude-agent-sdk/cli.js:4796:117)

Workflow yml file
name: Claude Code Review

on:
workflow_call:
inputs:
pr_number:
required: true
type: number
pr_author:
required: true
type: string
head_ref:
required: true
type: string
secrets:
CLAUDE_CODE_OAUTH_TOKEN:
required: true

jobs:
claude-review:
runs-on: ubuntu-latest
if: github.event.pull_request.user.login != 'dependabot[bot]'

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.head_ref }}
fetch-depth: 0

- name: Claude Code Review
uses: anthropics/claude-code-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
anthropic_api_key: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
prompt_file: .github/claude-review-prompt.md

API Provider
- [x] Anthropic First-Party API (default)

Additional context
- The bash script (badgetizr) runs successfully locally with bash badgetizr --help
- All 181 bats tests pass locally: make test succeeds
- ShellCheck validation passes: no syntax errors reported
- The problematic line is standard bash variable concatenation
- The SDK appears to internally generate ${all_badges:+...} syntax during parsing, which then fails
- This only affects CI/CD environments using the GitHub Action, not local execution

Minimal reproducible example:
```bash
#!/bin/bash
all_badges=""
ready_for_approval_badge="test"
all_badges="${ready_for_approval_badge} ${all_badges}" # This line causes SDK parsing error
echo "$all_badges”
```
This valid bash code triggers the parsing error in Claude Code SDK but executes correctly in any bash shell.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.