From 4844e2eafa9d68e14f0d2e1fec332d0def8987b7 Mon Sep 17 00:00:00 2001 From: fireddd Date: Fri, 10 Apr 2026 02:25:01 +0530 Subject: [PATCH] fix(ci): handle 403 when updating coverage comment on fork PRs Fork PR tokens cannot PATCH comments owned by a different integration. Fall back to creating a new comment when the update fails instead of failing the entire step. Closes #913 Co-Authored-By: Claude Opus 4.6 --- .github/workflows/coverage.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index f3a1dcc3c..56d61959a 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -101,10 +101,16 @@ jobs: | tail -1) if [ -n "$COMMENT_ID" ]; then - gh api "repos/$REPO/issues/comments/$COMMENT_ID" \ + # Update may fail on fork PRs (403) — fall back to creating a new comment + if gh api "repos/$REPO/issues/comments/$COMMENT_ID" \ -X PATCH \ - -F body=@coverage-comment.md - echo "Updated existing comment $COMMENT_ID" + -F body=@coverage-comment.md 2>/dev/null; then + echo "Updated existing comment $COMMENT_ID" + else + echo "Could not update comment $COMMENT_ID, creating new one" + gh pr comment "$PR_NUMBER" --body-file coverage-comment.md + echo "Created new comment" + fi else gh pr comment "$PR_NUMBER" --body-file coverage-comment.md echo "Created new comment"