Skip to content

Commit e4f072c

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

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

.github/workflows/build.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,16 @@ jobs:
7171
id: artifacts-size-report
7272
if: ${{ matrix.java == '11.0.x' }} # do it once
7373
run: |
74-
report='## Artifacts Size Report\n\n'
75-
report+='| Module | Version | Size |\n'
76-
report+='| --- | --- | --- |\n'
74+
echo '## Artifacts Size Report' > report.md
75+
echo '| Module | Version | Size |' >> report.md
76+
echo '| --- | --- | --- |' >> report.md
7777
artifact_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
7878
for artifact in $(cat target/powertools-parent-*.buildinfo | grep 'outputs.*.jar' | grep -v 'sources.jar'); do
7979
artifact_name=$(echo "$artifact" | cut -d '=' -f2)
8080
artifact_name=${artifact_name%-$artifact_version.jar}
8181
artifact_size=$(grep "${artifact%%.filename*}.length" target/powertools-parent-*.buildinfo | cut -d '=' -f2)
82-
echo "$artifact_name = $artifact_size"
83-
report+="| ${artifact_name} | ${artifact_version} | ${artifact_size} |\n"
82+
echo "| ${artifact_name} | ${artifact_version} | ${artifact_size} |" >> report.md
8483
done
85-
echo "ARTIFACT_REPORT=$report" >> "$GITHUB_OUTPUT"
8684
- name: Find potential existing report
8785
if: ${{ matrix.java == '11.0.x' }} # do it once
8886
uses: peter-evans/find-comment@a54c31d7fa095754bfef525c0c8e5e5674c4b4b1 # 2.4.0
@@ -91,13 +89,13 @@ jobs:
9189
issue-number: ${{ github.event.pull_request.number }}
9290
comment-author: 'github-actions[bot]'
9391
body-includes: Artifacts Size Report
94-
- name: Artifacts size report in comment
92+
- name: Write artifacts size report in comment
9593
if: ${{ matrix.java == '11.0.x' }} # do it once
9694
uses: peter-evans/create-or-update-comment@c6c9a1a66007646a28c153e2a8580a5bad27bcfa # 3.0.2
9795
with:
9896
comment-id: ${{ steps.find-comment.outputs.comment-id }}
9997
issue-number: ${{ github.event.pull_request.number }}
100-
body: "${{ steps.artifacts-size-report.outputs.ARTIFACT_REPORT }}"
98+
body-path: 'report.md'
10199
edit-mode: replace
102100
savepr:
103101
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)