Skip to content

Commit 918805d

Browse files
committed
Add PR artifact uploads and comments
Update the build workflow to handle pull request runs: make the main artifact upload conditional (skip for pull_request), add a separate upload step for PR artifacts with longer retention, and post a sticky PR comment containing a download link. Also adjust workflow permissions to allow pull-request write access and include updated artifact paths.
1 parent 735bfa6 commit 918805d

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

.github/workflows/build.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828
name: (${{ matrix.os_prefix }}/${{ matrix.arch }}) Create Processing Build
2929
runs-on: ${{ matrix.os }}
3030
needs: test
31+
permissions:
32+
pull-requests: write
3133
strategy:
3234
fail-fast: false
3335
matrix:
@@ -64,7 +66,28 @@ jobs:
6466

6567
- name: Add artifact
6668
uses: actions/upload-artifact@v4
69+
if: ${{ github.event_name != 'pull_request' }}
6770
with:
6871
name: processing-${{ matrix.os_prefix }}-${{ matrix.arch }}-br_${{ github.ref_name }}
6972
retention-days: 1
70-
path: app/build/compose/binaries/main/${{ matrix.binary }}
73+
path: app/build/compose/binaries/main/${{ matrix.binary }}
74+
75+
- name: Add artifact for PR
76+
if: ${{ github.event_name == 'pull_request' }}
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: processing-${{ matrix.os_prefix }}-${{ matrix.arch }}-pr_${{ github.event.pull_request.number }}
80+
retention-days: 5
81+
path: app/build/compose/binaries/main/${{ matrix.binary }}
82+
83+
- name: Add comment with binaries
84+
if: ${{ github.event_name == 'pull_request' }}
85+
uses: marocchino/sticky-pull-request-comment@v2
86+
with:
87+
append: true
88+
header: '## Build Artifacts'
89+
message: |
90+
### (${{ matrix.os_prefix }}/${{ matrix.arch }}) Build Artifacts
91+
- [Download processing-${{ matrix.os_prefix }}-${{ matrix.arch }}-pr_${{ github.event.pull_request.number }}](${{ steps.upload-artifact.outputs.download_url }})
92+
env:
93+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)