Skip to content

Commit 91cc399

Browse files
committed
Update build comment if it already exists
This changes the workflow to update the existing comment about the test build if that comment already exists. It embeds a hidden field within the comment body to find it. Since some PRs get force pushed a lot, particularly Renovate ones, this prevents a very long line of repeated comments.
1 parent f2a6d8b commit 91cc399

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

.github/workflows/main.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,23 @@ jobs:
163163
path: output/
164164
retention-days: 1 # quite low retention, because the artifacts are quite large
165165
overwrite: true # overwrite old artifacts if a PR runs again (artifacts are per PR * per project)
166-
- name: Add comment
166+
- name: Find existing comment
167+
uses: peter-evans/find-comment@v3
168+
if: github.event.pull_request.head.repo.full_name == github.repository
169+
id: find-comment
170+
with:
171+
issue-number: ${{ github.event.pull_request.number }}
172+
comment-author: 'github-actions[bot]'
173+
body-includes: '<!-- build-artifacts -->'
174+
- name: Add or update comment
167175
uses: peter-evans/create-or-update-comment@v5
168-
# Check if the event is not triggered by a fork
169-
# https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#restrictions-on-repository-forks
170176
if: github.event.pull_request.head.repo.full_name == github.repository
171177
with:
178+
comment-id: ${{ steps.find-comment.outputs.comment-id }}
172179
issue-number: ${{ github.event.pull_request.number }}
180+
edit-mode: replace
173181
body: |-
182+
<!-- build-artifacts -->
174183
The rpm/deb packages and the JAR file for openvoxdb are available in a zip archive:
175184
${{ steps.upload.outputs.artifact-url }}
176185

0 commit comments

Comments
 (0)