anthropics / anthropics/claude-code-action

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

オープン
#907 コメント 1 件 リアクション 4 件 担当者 0 名 GitHub で見る
area:permissions bug p2 provider:1p
主要言語
TypeScript
スター
8.9k
フォーク
2.1k
平均マージ
3日 9時間
マージ済み PR(30日)
10

説明

## 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.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。