Skip to content

Commit 4e0e02a

Browse files
[CONFIG] Testing with updated permissions (- WIP #338 -)
Changes in file .github/workflows/CI-BUILD.yml: * Refactored to allow summary comment with updated permissions
1 parent 9fb4236 commit 4e0e02a

File tree

1 file changed

+33
-9
lines changed

1 file changed

+33
-9
lines changed

.github/workflows/CI-BUILD.yml

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ jobs:
248248
BUILD_ID: ${{ github.run_id }}
249249
BUILD_SHA: ${{ github.sha }}
250250
BUILD_ARTIFACT_FILES: ${{ steps.output_artifact_files.outputs.files }}
251-
BUILD_COMMENT_BODY: '${{ github.workspace }}/BUILD_COMMENT_BODY_${{ github.sha }}.md'
251+
BUILD_COMMENT_BODY: '${{ github.workspace }}/Build-Summary-Artifact.txt'
252252
shell: bash
253253
run: |
254254
printf "%s\n" "## :building_construction: Build" > "${BUILD_COMMENT_BODY}"
@@ -260,28 +260,52 @@ jobs:
260260
printf "%s\n" " * Including producing the build artifact [multicast-build-${BUILD_SHA}](https://github.com/reactive-firewall/multicast/actions/runs/${BUILD_ID}#artifacts)" >> "${BUILD_COMMENT_BODY}"
261261
fi
262262
cat <"${BUILD_COMMENT_BODY}" >> "$GITHUB_STEP_SUMMARY"
263-
ls -lap "${BUILD_COMMENT_BODY}"
264-
cat <"${BUILD_COMMENT_BODY}"
265263
if: ${{ success() && (github.repository == 'reactive-firewall/multicast') }}
266264
- name: "Summarize Build (FAILED)"
267265
id: summarize-build-failure
268266
env:
269267
BUILD_ID: ${{ github.run_id }}
270268
BUILD_SHA: ${{ github.sha }}
271-
BUILD_COMMENT_BODY: '${{ github.workspace }}/BUILD_COMMENT_BODY_${{ github.sha }}.md'
269+
BUILD_COMMENT_BODY: '${{ github.workspace }}/Build-Summary-Artifact.txt'
272270
shell: bash
273271
run: |
274272
printf "%s\n" "## :construction: Build" > "${BUILD_COMMENT_BODY}"
275273
printf "%s\n" ":x: ~BUILD ${BUILD_ID} succeeded with commit [${BUILD_SHA}](https://github.com/reactive-firewall/multicast/commit/${BUILD_SHA})~" > "${BUILD_COMMENT_BODY}"
276274
cat <"${BUILD_COMMENT_BODY}" >> "$GITHUB_STEP_SUMMARY"
277-
ls -lap "${BUILD_COMMENT_BODY}"
278-
cat <"${BUILD_COMMENT_BODY}"
279275
if: ${{ failure() && (github.repository == 'reactive-firewall/multicast') }}
280-
- name: "Build commit comment"
276+
- name: Upload build summary
277+
id: upload-build-summary
281278
if: ${{ !cancelled() && (github.repository == 'reactive-firewall/multicast') }}
282-
id: build_commit_comment
279+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
280+
with:
281+
path: ./Build-Summary-Artifact.txt
282+
name: BUILD-COMMENT-BODY-${{ github.sha }}
283+
if-no-files-found: error
284+
compression-level: 3
285+
retention-days: 2
286+
overwrite: true
287+
288+
BUILD_SUMMARY:
289+
permissions:
290+
actions: read
291+
contents: write
292+
needs: [BUILD, BUILD_STATUS]
293+
runs-on: ubuntu-latest
294+
environment: ${{ needs.BUILD_STATUS.outputs.environment }}
295+
if: ${{ !cancelled() }}
296+
steps:
297+
- name: "Download Status Summary Artifact"
298+
id: download-build-summary
299+
if: ${{ !cancelled() && (github.repository == 'reactive-firewall/multicast') }}
300+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
301+
with:
302+
name: BUILD-COMMENT-BODY-${{ github.sha }}
303+
github-token: ${{ github.token }}
304+
- name: "Build commit comment"
305+
id: build-commit-comment
306+
if: ${{ success() && (github.repository == 'reactive-firewall/multicast') }}
283307
uses: peter-evans/commit-comment@5a6f8285b8f2e8376e41fe1b563db48e6cf78c09 # v3.0.0
284308
with:
285309
sha: ${{ github.sha }}
286310
token: ${{ github.token }}
287-
body-path: '${{ github.workspace }}/BUILD_COMMENT_BODY_${{ github.sha }}.md'
311+
body-path: '${{ steps.download-build-summary.outputs.download-path }}/Build-Summary-Artifact.txt'

0 commit comments

Comments
 (0)