#17 fix: handle pull_request_review_comment payload differences in Gitea (#19)

This commit is contained in:
leoarry
2026-06-08 09:13:54 +01:00
committed by GitHub
parent dfdfdd91fe
commit b744372179
6 changed files with 83 additions and 54 deletions
+16 -9
View File
@@ -41,15 +41,22 @@ async function run() {
// GitHub has separate ID namespaces for review comments and issue comments
// We need to use the correct API based on the event type
if (isPullRequestReviewCommentEvent(context)) {
// For PR review comments, use the pulls API
console.log(`Fetching PR review comment ${commentId}`);
const response = await client.api.customRequest(
"GET",
`/api/v1/repos/${owner}/${repo}/pulls/comments/${commentId}`,
);
comment = response.data;
isPRReviewComment = true;
console.log("Successfully fetched as PR review comment");
// Try the PR review comment endpoint first; Gitea may have created an
// issue comment instead (no comment.id in payload), so fall through on 404.
try {
console.log(`Fetching PR review comment ${commentId}`);
const response = await client.api.customRequest(
"GET",
`/api/v1/repos/${owner}/${repo}/pulls/comments/${commentId}`,
);
comment = response.data;
isPRReviewComment = true;
console.log("Successfully fetched as PR review comment");
} catch {
console.log(
"PR review comment not found, falling back to issue comment",
);
}
}
// For all other event types, use the issues API