fix: fallback to issue comment API when PR review comment fetch fails#4
Open
fix: fallback to issue comment API when PR review comment fetch fails#4
Conversation
When the triggering event is pull_request_review_comment but the actual comment created was a fallback issue comment (due to pending review error), the update-comment-link script would fail with 404 because it only tried the PR review comment API. This change wraps the PR review comment fetch in its own try-catch so it can fall through to try the issue comment API when the PR review comment fetch fails (e.g., 404). This fixes the scenario where: 1. User triggers @cuvvy via PR review comment 2. Initial comment reply fails with "user_id can only have one pending review" 3. Fallback creates an issue comment instead 4. Claude runs successfully 5. update-comment-link fails trying to fetch the issue comment via pulls API 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
fa3c208 to
80f70b3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When the triggering event is
pull_request_review_commentbut the actual comment created was a fallback issue comment (due to pending review error), theupdate-comment-linkscript would fail with 404 because it only tried the PR review comment API.This change wraps the PR review comment fetch in its own try-catch so it can fall through to try the issue comment API when the PR review comment fetch fails (e.g., 404).
Problem
This fixes the scenario where:
"user_id can only have one pending review per pull request"(HTTP 422)update-comment-linkfails trying to fetch the issue comment via the PR review comments API (404)Example failure: https://github.com/cuvva/app-cuvva-android/actions/runs/20337962345/job/58429260193
Test plan
🤖 Generated with Claude Code