Skip to content

Commit 7bbc8e3

Browse files
authored
Publish test results for fork PRs (#4336)
#### What type of PR is this? Purely CI #### What this PR does / why we need it: Test results of pull requests from fork repositories are currently not published. The current setup makes them fail: Resource not accessible by integration https://github.com/armadaproject/armada/actions/runs/14449584216/job/40518701460#step:5:2282 This is because the CI is executed in the context of the fork repository, where Github Actions does not have permissions to write to the upstream pull request (required by the publish action). #### Which issue(s) this PR fixes: This applies the pattern documented at https://github.com/mikepenz/action-junit-report#pr-run-permissions. --------- Signed-off-by: Enrico Minack <github@enrico.minack.dev>
1 parent 901a97e commit 7bbc8e3

File tree

2 files changed

+30
-30
lines changed

2 files changed

+30
-30
lines changed

.github/workflows/test-results.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Test results
2+
on:
3+
workflow_run:
4+
workflows: [ CI ]
5+
types: [ completed ]
6+
7+
permissions:
8+
checks: write
9+
10+
jobs:
11+
checks:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Download Test Report
15+
uses: dawidd6/action-download-artifact@v9
16+
with:
17+
name: '.*-test-reports'
18+
name_is_regexp: true
19+
path: test-results
20+
workflow: ${{ github.event.workflow.id }}
21+
run_id: ${{ github.event.workflow_run.id }}
22+
23+
- name: Publish JUnit Report
24+
uses: mikepenz/action-junit-report@v6
25+
with:
26+
report_paths: ./test-results/*/*.xml
27+
fail_on_failure: true
28+
require_tests: true
29+
detailed_summary: true
30+
commit: ${{github.event.workflow_run.head_sha}}

.github/workflows/test.yml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,6 @@ jobs:
2828
yarn install --frozen-lockfile && yarn openapi && yarn build && CI=true yarn test --reporter=junit
2929
working-directory: ./internal/lookoutui
3030

31-
- name: Publish JUnit Report
32-
uses: mikepenz/action-junit-report@v6
33-
if: always()
34-
with:
35-
report_paths: ./internal/lookoutui/junit.xml
36-
fail_on_failure: true
37-
require_tests: true
38-
detailed_summary: true
39-
token: ${{ secrets.GITHUB_TOKEN }}
40-
4131
- name: Upload Test Reports Artifacts
4232
if: always()
4333
uses: actions/upload-artifact@v5
@@ -66,16 +56,6 @@ jobs:
6656
id: unit_test
6757
run: go run github.com/magefile/mage@v1.14.0 -v tests
6858

69-
- name: Publish JUnit Report
70-
uses: mikepenz/action-junit-report@v6
71-
if: always()
72-
with:
73-
report_paths: test-reports/unit-tests.xml
74-
fail_on_failure: true
75-
require_tests: true
76-
detailed_summary: true
77-
token: ${{ secrets.GITHUB_TOKEN }}
78-
7959
- name: Upload Test Reports Artifacts
8060
if: always()
8161
uses: actions/upload-artifact@v5
@@ -145,16 +125,6 @@ jobs:
145125
./logs/
146126
if-no-files-found: error
147127

148-
- name: Publish JUnit Report
149-
uses: mikepenz/action-junit-report@v6
150-
if: always()
151-
with:
152-
report_paths: junit.xml
153-
fail_on_failure: true
154-
require_tests: true
155-
detailed_summary: true
156-
token: ${{ secrets.GITHUB_TOKEN }}
157-
158128
go-mod-up-to-date:
159129
name: Golang Mod Up To Date
160130
runs-on: ubuntu-22.04

0 commit comments

Comments
 (0)