anthropics / anthropics/claude-code-action

use_sticky_comment creates a new comment on PRs with more than 30 comments: the sticky lookup only reads the first page

Offen
#1,781 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug p2
Vorherrschende Sprache
TypeScript
Sterne
8.9k
Forks
2.1k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

**Type:** bug
**Severity:** low-medium (feature silently stops working on busy PRs)
**Area:** `src/github/operations/comments/create-initial.ts`
**Effort:** trivial

## Summary

`action.yml` documents `use_sticky_comment` as "Use just one comment to deliver issue/PR comments". `createInitialComment` looks for the existing Claude comment with a single unpaginated `octokit.rest.issues.listComments` call (default 30 per page) and runs `.find` over `comments.data` of page 1 only (`create-initial.ts` lines 36-49). On a PR with more than 30 comments where Claude's comment is not among the first 30, every run creates a new comment.

`src/github/data/fetcher.ts` (around lines 136-145) already uses `octokit.paginate` for the same class of call, and #1629 fixed the same pagination problem in the CI server.

## Reproduction

Running the real `createInitialComment` with `createOctokit` against a fake REST API that serves 35 comments with the Claude comment at position 33:

```
requests: [ "GET /repos/o/r/issues/7/comments", "POST /repos/o/r/issues/7/comments" ]
result comment id: 9999 (a NEW comment was created; sticky not honored)
```

## Expected

`PATCH /repos/o/r/issues/comments/4242` (the existing comment) and `comment_id` output `4242`.

## Root cause

No pagination: `listComments` without `per_page`, and `.find` on the first page only.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.