From e18ce8e1ee859c0481fe8ab50fdd7e8a82ba1896 Mon Sep 17 00:00:00 2001 From: Svilen Stefanov Date: Sat, 1 Aug 2026 08:40:02 +0200 Subject: [PATCH] fix: don't let a late failure erase a review that already posted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The failure and quota comments reuse the review comment's sticky header, so posting either one REPLACES the architecture diff rather than adding to it. Any step that fails after the review has been published therefore deletes the thing the user came for, and the PR ends up showing "Architecture review · failed" for a review that succeeded. Seen on CodeBoarding-webview#22: diagram, body, artifact upload and the sticky comment all succeeded, then an enrichment step failed and overwrote the result. Gives the review comment an `id` and gates both failure paths on `steps.review_comment.outcome != 'success'`. A step failing after publication cannot un-publish the review, so it must not erase it either. Every genuine failure path is unaffected: when the review never posts the outcome is `skipped` (or empty, if the job died earlier), both of which are != 'success', so the failure and quota comments still appear as before. Sync mode is untouched — those steps are already gated on `mode == 'review'`. Co-Authored-By: Claude Opus 5 (1M context) --- action.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 75fc874..070de00 100644 --- a/action.yml +++ b/action.yml @@ -1406,7 +1406,11 @@ runs: echo "body_file=$BODY_FILE" >> "$GITHUB_OUTPUT" + # `id` so the failure paths below can tell "the review never got posted" from + # "the review posted fine and something after it broke". They share this step's + # sticky header, so without that distinction they REPLACE a good review. - name: Post sticky PR comment + id: review_comment if: steps.guard.outputs.skip != 'true' && steps.guard.outputs.mode == 'review' uses: marocchino/sticky-pull-request-comment@v2 with: @@ -1795,7 +1799,7 @@ runs: fi - name: Post quota-exhausted comment - if: failure() && steps.guard.outputs.skip != 'true' && steps.guard.outputs.mode == 'review' && steps.quota.outputs.exhausted == 'true' + if: failure() && steps.guard.outputs.skip != 'true' && steps.guard.outputs.mode == 'review' && steps.quota.outputs.exhausted == 'true' && steps.review_comment.outcome != 'success' continue-on-error: true uses: marocchino/sticky-pull-request-comment@v2 with: @@ -1815,8 +1819,12 @@ runs: codeboarding-action · run ${{ github.run_id }} GITHUB_TOKEN: ${{ inputs.github_token }} + # Not posted when the review itself already went out: these comments reuse the + # review's sticky header, so posting one REPLACES the architecture diff the user + # came for. A step failing after the review has been published (the walkthrough + # add-on, an artifact upload) cannot un-publish it, and must not erase it either. - name: Post failure comment - if: failure() && steps.guard.outputs.skip != 'true' && steps.guard.outputs.mode == 'review' && steps.quota.outputs.exhausted != 'true' + if: failure() && steps.guard.outputs.skip != 'true' && steps.guard.outputs.mode == 'review' && steps.quota.outputs.exhausted != 'true' && steps.review_comment.outcome != 'success' continue-on-error: true uses: marocchino/sticky-pull-request-comment@v2 with: