Skip to content

Commit aef4fe5

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 3273dec commit aef4fe5

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:
@@ -136,10 +134,10 @@ jobs:
136134
echo "</details>"
137135
echo "${delimiter}"
138136
} >> "$GITHUB_OUTPUT"
137+
# Run unconditionally so we can clear a stale comment when regressions are fixed.
139138
- name: Find Comment
140139
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
141140
id: fc
142-
if: steps.generate-diff-reports.outputs.reports != ''
143141
with:
144142
issue-number: ${{ steps.get-pull-request-number.outputs.pull_request_number }}
145143
comment-author: 'github-actions[bot]'
@@ -152,4 +150,16 @@ jobs:
152150
comment-id: ${{ steps.fc.outputs.comment-id }}
153151
issue-number: ${{ steps.get-pull-request-number.outputs.pull_request_number }}
154152
body: ${{ steps.generate-diff-reports.outputs.reports }}
153+
edit-mode: replace
154+
155+
# If a previous run posted a diff comment but this run has none, the regressions are fixed.
156+
- name: Mark previous regressions as resolved
157+
if: >
158+
steps.check-if-there-are-valid-files.outputs.exist_valid_files == 'false' &&
159+
steps.fc.outputs.comment-id != ''
160+
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
161+
with:
162+
comment-id: ${{ steps.fc.outputs.comment-id }}
163+
body: |
164+
Snapshot diff report: Previous regressions were resolved by the latest commit.
155165
edit-mode: replace

0 commit comments

Comments
 (0)