Skip to content

Commit 5e3da85

Browse files
committed
update comment if already exists in pull request
1 parent a3c5a5b commit 5e3da85

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

.github/workflows/build.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,22 @@ jobs:
8383
report+="| ${artifact_name} | ${artifact_version} | ${artifact_size} |\n"
8484
done
8585
echo "ARTIFACT_REPORT=$report" >> "$GITHUB_OUTPUT"
86-
- name: Comment artifacts size report
86+
- name: Find potential existing report
8787
if: ${{ matrix.java == '11.0.x' }} # do it once
88-
uses: actions/github-script@v6
88+
uses: peter-evans/find-comment@a54c31d7fa095754bfef525c0c8e5e5674c4b4b1 # 2.4.0
89+
id: find-comment
8990
with:
90-
script: |
91-
github.rest.issues.createComment({
92-
issue_number: context.issue.number,
93-
owner: context.repo.owner,
94-
repo: context.repo.repo,
95-
body: "${{ steps.artifacts-size-report.outputs.ARTIFACT_REPORT }}"
96-
})
97-
91+
issue-number: ${{ github.event.pull_request.number }}
92+
comment-author: 'github-actions[bot]'
93+
body-includes: Artifacts Size Report
94+
- name: Artifacts size report in comment
95+
if: ${{ matrix.java == '11.0.x' }} # do it once
96+
uses: peter-evans/create-or-update-comment@c6c9a1a66007646a28c153e2a8580a5bad27bcfa # 3.0.2
97+
with:
98+
comment-id: ${{ steps.find-comment.outputs.comment-id }}
99+
issue-number: ${{ github.event.pull_request.number }}
100+
body: "${{ steps.artifacts-size-report.outputs.ARTIFACT_REPORT }}"
101+
edit-mode: replace
98102
savepr:
99103
runs-on: ubuntu-latest
100104
name: Save PR number if running on PR by dependabot

0 commit comments

Comments
 (0)