anthropics / anthropics/claude-code-action
use_sticky_comment does not work with pull_request_target events
- Langage dominant
- TypeScript
- Étoiles
- 8.9k
- Forks
- 2.1k
- Merge moyen
- 3 j 9 h
- PR mergées (30 j)
- 10
Description
## Describe the bug
`use_sticky_comment: true` only works with `pull_request` events and does not function with `pull_request_target` events. This forces users who need fork PR security to fall back to `gh pr comment`, which posts as `github-actions[bot]` instead of `claude[bot]`.
## To Reproduce
1. Create a workflow using `pull_request_target` trigger (required for secure fork PR handling)
2. Configure claude-code-action with `use_sticky_comment: true`
3. Open a PR from a fork
4. Observe that the sticky comment feature does not work
## Expected behavior
`use_sticky_comment` should work with both `pull_request` and `pull_request_target` events, allowing users to maintain fork PR security while still having comments posted as `claude[bot]`.
## Workflow yml file
```yaml
name: Claude Code Review
on:
pull_request_target:
types: [opened, synchronize, reopened]
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: anthropics/claude-code-action@main
with:
use_sticky_comment: true # Does not work with pull_request_target
# ... other config
```
## API Provider
- [x] Anthropic First-Party API
- [ ] AWS Bedrock
- [ ] GCP Vertex
## Additional context
**Why this matters:**
- `pull_request_target` is the recommended approach for workflows that need secrets access when reviewing fork PRs
- Without this fix, users must choose between:
1. Fork PR security (`pull_request_target`) but comments from `github-actions[bot]`
2. Native `claude[bot]` comments (`pull_request` + `use_sticky_comment`) but no secure fork PR handling
**Workaround:** Use `gh pr comment` in the prompt, accepting that comments appear from `github-actions[bot]`.
**Related discussion:** [sjnims/requirements-expert#65](https://github.com/sjnims/requirements-expert/issues/65)
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.