anthropics / anthropics/claude-code-action

Setup doesn't mention that to review dependabot PRs one needs to set dependabot secrets in addition to repository secrets

Đang mở
#744 0 bình luận 7 reaction 0 người được giao Xem trên GitHub
area:installation documentation p3
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ả

I have a Github action to have Claude Code review PRs set up to trigger on pull_request.

```
on:
pull_request:
types: [opened, ready_for_review]

...SKIP...

- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
```

This action fails on PRs triggered by dependabot (it works for PRs made by contributors):

```
Error: Action failed with error: Error: Environment variable validation failed:
- Either ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN is required when using direct Anthropic API.
Error: Process completed with exit code 1.
```

Per [Github documentation](https://docs.github.com/en/code-security/dependabot/troubleshooting-dependabot/troubleshooting-dependabot-on-github-actions#troubleshooting-failures-when-dependabot-triggers-existing-workflows):

> For workflows initiated by Dependabot (`github.actor == 'dependabot[bot]'`) using the pull_request, pull_request_review, pull_request_review_comment, push, create, deployment, and deployment_status events, these restrictions apply:
> - Secrets are populated from Dependabot secrets. GitHub Actions secrets are not available.

Dependabot secrets can be added at `https://github.com/OWNER/REPOSITORY/settings/secrets/dependabot` under "Secrets and variables > Dependabot":

[![enter image description here](https://i.sstatic.net/9nyq2cgK.png)](https://i.sstatic.net/9nyq2cgK.png)

One can reuse the same name so that the workflow works for dependabot as well as the original triggers.

This should be added to the docs so one doesn't suddenly get failing actions on dependabot PRs.

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.