anthropics / anthropics/claude-code-action

use_sticky_comment does not work with pull_request_target events

Abierto
#705 1 comentario 6 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
8.9k
Forks
2.1k
Merge medio
3 d 9 h
PR fusionados (30 d)
10

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.