anthropics / anthropics/claude-code-action

PR review workflow fails on forks from users without upstream write access

Đang mở
#974 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
area:permissions bug p2 provider:bedrock
Ngôn ngữ chính
TypeScript
Star
8.9k
Fork
2.1k
Merge trung bình
3 ngày 9 giờ
Pull request đã merge (30 ngày)
10

Mô tả

**Describe the bug**
When using `claude-code-action` in a **read-only PR review workflow** in fork repos for users without write access to upstream fails when trying to use the github token from Anthropic OIDC, with:

```
Error: Action failed with error: User does not have write access on this repository
```

The workflow only performs code review tasks — reading files, posting PR comments, and leaving inline review comments. It does not need to push commits, create branches, or modify repository contents via the GitHub API.

**To Reproduce**

The action is invoked with tools restricted to read/review operations:

```yaml
- uses: anthropics/claude-code-action@v2
with:
allowed_non_write_users: "*"
claude_args: |
--allowedTools "Read,Glob,Grep,Bash,Write,mcp__github_inline_comment__create_inline_comment"
```

(The `Write` tool here is Claude Code's local filesystem write — used to write a temp file before posting via `gh pr comment --body-file` — not a GitHub API write.)

**Expected behavior**
The GHA should not fail checking for write permission for a Github workflow that will not perform writes on the repository.

**Workaround**
passing `github_token` associated with our runner works, but then actions are not associated with `claude` bot user:

```yaml
- uses: anthropics/claude-code-action@v2
with:
github_token: ${{ github.token }}
allowed_non_write_users: "*"
claude_args: |
--allowedTools "Read,Glob,Grep,Bash,Write,mcp__github_inline_comment__create_inline_comment"
```

**API Provider**

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.