anthropics / anthropics/claude-code-action

PR review comment is broken because of newline chars

Offen
#543 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
TypeScript
Sterne
8.9k
Forks
2.1k
Ø Merge
3 T. 9 Std.
Gemergte PRs (30 T.)
10

Beschreibung

**Describe the bug**

When Claude uses `gh` to post a PR comment, `\n` newlines are escaped and not interpreted in the final comment

**Screenshots**

Image

**Workflow yml file**

```yaml
name: Claude Code / on PR update

on:
pull_request:
types:
- opened
- labeled
- synchronize

permissions:
id-token: write
contents: read

jobs:
review:
runs-on: small
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
token: ${{ secrets.GH_DOTCOM_TOKEN }}
- name: Assume role
id: assume-aws-role
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: eu-west-3
role-to-assume: ...
role-session-name: claude-code-pr-${{ github.event.pull_request.number }}
unset-current-credentials: true
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.CLAUDE_CODE_APP_ID }}
private-key: ${{ secrets.CLAUDE_CODE_APP_PRIVATE_KEY }}
- name: Get GitHub App bot identity
id: get-bot-identity
run: |
echo "user_id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_HOST: github.mpi-internal.com
# Use regular GHA token to get the bot user ID because the app token does not have permissions to call /users/:username endpoint
GH_ENTERPRISE_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: anthropics/claude-code-action@v1.0.3
timeout-minutes: 10
env:
GH_HOST: github.mpi-internal.com
GH_ENTERPRISE_TOKEN: ${{ steps.app-token.outputs.token }}
with:
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}

Please review this pull request.

Note: The PR branch is already checked out in the current working directory.

Focus on:
- Code quality and best practices
- Potential bugs or issues
- Performance considerations
- Security implications
- Test coverage
- Documentation updates if needed
- Verify that README.md and docs are updated for any new features or config changes

Provide constructive feedback with specific suggestions for improvement.
Use `gh pr comment:*` for top-level comments.
Use `mcp__github_inline_comment__create_inline_comment` to highlight specific areas of concern.
Only your GitHub comments that you post will be seen, so don't submit your review as a normal message, just as comments.
If the PR has already been reviewed, or there are no noteworthy changes, don't post anything.
base_branch: 'master'
github_token: ${{ steps.app-token.outputs.token }}
github_token: ${{ steps.app-token.outputs.token }}
bot_id: ${{ steps.get-bot-identity.outputs.user_id }}
bot_name: "${{ steps.app-token.outputs.app-slug }}[bot]"
# Use CI-specific Claude settings
use_bedrock: true
settings: .claude/settings.ci.json
claude_args: |
--allowedTools "mcp__github_inline_comment__create_inline_comment,mcp__github_comment__update_claude_comment,Bash(gh pr comment:*), Bash(gh pr diff:*), Bash(gh pr view:*)"
# To read CI job status
additional_permissions: |
actions: read
```

**API Provider**

[ ] Anthropic First-Party API (default)
[x] AWS Bedrock
[ ] GCP Vertex

**Additional context**
Add any other context about the problem here.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.