fix: fix fetch DROID_COMMENT_ID bug #22
Merged
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.
Closes FAC-15570
Bug
Users see a 404 error when update-comment-link.ts tries to fetch a comment:
Root Cause
GitHub uses separate ID namespaces and API endpoints for:
• Issue comments (issues.getComment)
• PR review comments (pulls.getReviewComment)
The original code determined which API to call based solely on the event type (pull_request_review_comment vs everything else). However, the DROID_COMMENT_ID could be a PR review comment ID even when the current event is pull_request (e.g., the comment was created in a previous workflow step).
When querying a PR review comment ID via the issue comments endpoint, GitHub returns 404.
Fix
Extracted comment fetching into a new helper function fetchDroidComment that tries both APIs:
First tries the API matching the event type (for efficiency)
Falls back to the other API if the first returns 404
This handles cases where the comment type doesn't match the event type.