anthropics / anthropics/claude-code-action

configureGitAuth function incompatible with actions/checkout@v4.3.1,v5.0.1,v6

Đang mở
#907 1 bình luận 4 reaction 0 người được giao Xem trên GitHub
area:permissions bug p2 provider:1p
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ả

## Description

The Claude GitHub App is installed on our repository with **Read and write** permissions for Contents, Pull Requests, and Issues (confirmed via the installation settings page). However, the installation token returned by the OIDC exchange does not have write access to repository contents, causing `git push` to fail with a 403.

## Reproduction

1. Install the official Claude GitHub App with Read & Write for code, PRs, and issues
2. Configure workflow with `claude_code_oauth_token` and `id-token: write`
3. Trigger Claude on a PR (in our case, created by a different GitHub App bot)
4. Claude commits locally, then runs `git push origin HEAD`

## Error

```
remote: Write access to repository not granted.
fatal: unable to access 'https://github.com//.git/': The requested URL returned error: 403
```

## Diagnostics

We had Claude run diagnostic commands during a workflow run:

- **OIDC exchange succeeds**: Logs show `App token successfully obtained`
- **Git remote URL is correctly rewritten**: `https://x-access-token:REDACTED@github.com/...`
- **Token lacks write permissions**:
```json
// gh api /installation/repositories --jq '.repositories[0].permissions'
{"admin": false, "maintain": false, "pull": false, "push": false, "triage": false}
```
- **Push dry-run confirms the 403**
- **App installation page confirms**: Read and write access to code, discussions, issues, pull requests, and workflows
- **Claude CAN comment on issues and PRs**, so the token has some write permissions — just not contents

## Configuration

```yaml
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
actions: read

steps:
- uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
additional_permissions: |
actions: read
```

The `additional_permissions` input means the exchange request should include `{contents: "write", pull_requests: "write", issues: "write", actions: "read"}` per the source in `token.ts`.

## Workaround

Passing an explicit `github_token` input (from a separate GitHub App via `actions/create-github-app-token`) bypasses the OIDC exchange and works.

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.