Skip to content

Commit 4606c1a

Browse files
fix: don't let a late failure erase a review that already posted (#66)
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) <noreply@anthropic.com>
1 parent b90704c commit 4606c1a

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎action.yml‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,7 +1417,11 @@ runs:
14171417
14181418
echo "body_file=$BODY_FILE" >> "$GITHUB_OUTPUT"
14191419
1420+
# `id` so the failure paths below can tell "the review never got posted" from
1421+
# "the review posted fine and something after it broke". They share this step's
1422+
# sticky header, so without that distinction they REPLACE a good review.
14201423
- name: Post sticky PR comment
1424+
id: review_comment
14211425
if: steps.guard.outputs.skip != 'true' && steps.guard.outputs.mode == 'review'
14221426
uses: marocchino/sticky-pull-request-comment@v2
14231427
with:
@@ -1806,7 +1810,7 @@ runs:
18061810
fi
18071811
18081812
- name: Post quota-exhausted comment
1809-
if: failure() && steps.guard.outputs.skip != 'true' && steps.guard.outputs.mode == 'review' && steps.quota.outputs.exhausted == 'true'
1813+
if: failure() && steps.guard.outputs.skip != 'true' && steps.guard.outputs.mode == 'review' && steps.quota.outputs.exhausted == 'true' && steps.review_comment.outcome != 'success'
18101814
continue-on-error: true
18111815
uses: marocchino/sticky-pull-request-comment@v2
18121816
with:
@@ -1826,8 +1830,12 @@ runs:
18261830
<sub>codeboarding-action · run ${{ github.run_id }}</sub>
18271831
GITHUB_TOKEN: ${{ inputs.github_token }}
18281832

1833+
# Not posted when the review itself already went out: these comments reuse the
1834+
# review's sticky header, so posting one REPLACES the architecture diff the user
1835+
# came for. A step failing after the review has been published (the walkthrough
1836+
# add-on, an artifact upload) cannot un-publish it, and must not erase it either.
18291837
- name: Post failure comment
1830-
if: failure() && steps.guard.outputs.skip != 'true' && steps.guard.outputs.mode == 'review' && steps.quota.outputs.exhausted != 'true'
1838+
if: failure() && steps.guard.outputs.skip != 'true' && steps.guard.outputs.mode == 'review' && steps.quota.outputs.exhausted != 'true' && steps.review_comment.outcome != 'success'
18311839
continue-on-error: true
18321840
uses: marocchino/sticky-pull-request-comment@v2
18331841
with:

0 commit comments

Comments
 (0)