Skip to content

Commit 9628294

Browse files
committed
build(ci): update screenshot comment if resolved
If the regressions were fixed, mark the PR as resolved Do not post a comment if one already existed Issue 20942 Assisted-by: Claude Opus 4.7 - all
1 parent 08ea081 commit 9628294

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

.github/workflows/screenshot_comment.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
# See the License for the specific language governing permissions and
1717
# limitations under the License.
1818

19-
# TODO: Handle the case where regressions are fixed
20-
2119
name: "🛠️ Screenshots: Comment"
2220

2321
on:
@@ -138,10 +136,10 @@ jobs:
138136
echo "</details>"
139137
echo "${delimiter}"
140138
} >> "$GITHUB_OUTPUT"
139+
# Run unconditionally so we can clear a stale comment when regressions are fixed.
141140
- name: Find Comment
142141
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
143142
id: fc
144-
if: steps.generate-diff-reports.outputs.reports != ''
145143
with:
146144
issue-number: ${{ steps.get-pull-request-number.outputs.pull_request_number }}
147145
comment-author: 'github-actions[bot]'
@@ -154,4 +152,16 @@ jobs:
154152
comment-id: ${{ steps.fc.outputs.comment-id }}
155153
issue-number: ${{ steps.get-pull-request-number.outputs.pull_request_number }}
156154
body: ${{ steps.generate-diff-reports.outputs.reports }}
155+
edit-mode: replace
156+
157+
# If a previous run posted a diff comment but this run has none, the regressions are fixed.
158+
- name: Mark previous regressions as resolved
159+
if: >
160+
steps.check-if-there-are-valid-files.outputs.exist_valid_files == 'false' &&
161+
steps.fc.outputs.comment-id != ''
162+
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
163+
with:
164+
comment-id: ${{ steps.fc.outputs.comment-id }}
165+
body: |
166+
Snapshot diff report: Previous regressions were resolved by the latest commit.
157167
edit-mode: replace

0 commit comments

Comments
 (0)