Skip to content

Commit ce1e0a6

Browse files
committed
workflows: Add post build artifacts
Upload the artifact url on successful PR build. Add action to post comment on PR conversation. Fix #16. Signed-off-by: Eduardo Gonzalez <eduardo.gonzalez@amarulasolutions.com>
1 parent 8f185f8 commit ce1e0a6

2 files changed

Lines changed: 53 additions & 0 deletions

File tree

.github/workflows/conf-build-test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,15 @@ jobs:
6464
echo "${{ github.event.pull_request.head.sha }}" > ${{ runner.temp }}/common/pr-head-sha
6565
6666
- name: Upload linux artifact
67+
id: upload_build
6768
uses: actions/upload-artifact@v4
6869
with:
6970
name: linux
7071
path: build/default-develop/packages-default-develop/*
7172

73+
- name: Save artifact URL to file
74+
run: echo "${{ steps.upload_build.outputs.artifact-url }}" > ${{ runner.temp }}/common/artifact_url.txt
75+
7276
- name: Upload common artifact
7377
uses: actions/upload-artifact@v4
7478
with:
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Lint and Comment on PR
2+
3+
on:
4+
workflow_run:
5+
workflows: [push-build-test-lint-release]
6+
types:
7+
- completed
8+
9+
jobs:
10+
comment:
11+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
12+
runs-on: ubuntu-latest
13+
permissions:
14+
actions: read
15+
pull-requests: write
16+
17+
steps:
18+
- name: 'Download common artifact'
19+
uses: actions/download-artifact@v4
20+
with:
21+
name: common
22+
github-token: ${{ secrets.GITHUB_TOKEN }}
23+
run-id: ${{ github.event.workflow_run.id }}
24+
path: ${{ runner.temp }}
25+
26+
- name: Build PR comment
27+
id: build_comment
28+
working-directory: ${{ runner.temp }}
29+
run: |
30+
echo "🧩 Build Artifacts" > comment.md
31+
echo "" >> comment.md
32+
echo "✅ The following build artifacts were produced:" >> comment.md
33+
echo "" >> comment.md
34+
url=$(cat artifact_url.txt)
35+
echo "- [**${{ runner.name }}**](${url})" >> comment.md
36+
echo "" >> comment.md
37+
38+
- name: Read PR variables
39+
id: getprv
40+
working-directory: ${{ runner.temp }}
41+
run: |
42+
echo "prn=$(cat pr_number)" >> $GITHUB_OUTPUT
43+
44+
- name: Post or update PR comment
45+
uses: peter-evans/create-or-update-comment@v4
46+
with:
47+
token: ${{ secrets.GITHUB_TOKEN }}
48+
issue-number: ${{ steps.getprv.outputs.prn }}
49+
body-path: ${{ runner.temp }}/comment.md

0 commit comments

Comments
 (0)