Skip to content

Commit a13bf8e

Browse files
committed
Make test-results a workflow triggered on wofkrlow_run instead of workflow_call to enable PR comments
1 parent c05a084 commit a13bf8e

File tree

2 files changed

+40
-18
lines changed

2 files changed

+40
-18
lines changed

.github/workflows/test-results.yml

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,58 @@
11
name: Test Report
22

3-
permissions:
4-
checks: write
5-
pull-requests: write
6-
73
on:
8-
workflow_call:
4+
workflow_run:
5+
workflows: ["Tests"]
6+
types:
7+
- completed
98

109
jobs:
11-
test_report:
10+
test-report:
11+
if: github.event.workflow_run.conclusion == 'success' || github.event.workflow_run.conclusion == 'failure'
1212
runs-on: ubuntu-latest
13+
permissions:
14+
checks: write
15+
pull-requests: write
16+
1317

14-
steps:
15-
18+
steps:
1619
- name: Download Results for Matlab R2022b
1720
uses: actions/download-artifact@v4
1821
with:
22+
run_id: ${{ github.event.workflow_run.id }}
1923
name: test-results-matlab-R2022b
2024
path: test-results/matlab-R2022b
2125

2226
- name: Download Results for Matlab Latest
2327
uses: actions/download-artifact@v4
2428
with:
29+
run_id: ${{ github.event.workflow_run.id }}
2530
name: test-results-matlab-latest
2631
path: test-results/matlab-latest
2732

2833
- name: Download Results for Octave
2934
uses: actions/download-artifact@v4
3035
with:
36+
run_id: ${{ github.event.workflow_run.id }}
3137
name: test-results-octave
3238
path: test-results/octave
33-
39+
40+
- name: Download Event File
41+
uses: actions/download-artifact@v4
42+
with:
43+
run_id: ${{ github.event.workflow_run.id }}
44+
name: event-file
45+
path: event-file
46+
3447
- name: Publish Test Results
3548
uses: EnricoMi/publish-unit-test-result-action@v2
3649
with:
37-
files: |
38-
test-results/*/testresults.xml
50+
commit: ${{ github.event.workflow_run.head_sha }}
51+
files: "test-results/**/testresults.xml"
52+
event_file: event-file/event.json
53+
event_name: ${{ github.event.workflow_run.event}}
54+
comment_mode: ${{ (github.event.workflow_run.event == 'pull_request' || github.event_name == 'pull_request') && 'always' || 'off' }}
55+
check_name: "Test Results"
56+
3957

4058

.github/workflows/tests.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,19 @@ jobs:
3838
with:
3939
submodules: 'true'
4040
- uses: ./.github/actions/test-octave
41-
42-
test-report:
43-
name: Collect Test Results
44-
needs: [test-matlab-stable, test-matlab-latest, test-octave-6]
45-
uses: ./.github/workflows/test-results.yml
46-
secrets: inherit
4741

4842
coverage-report:
4943
name: Collect Coverage Report
5044
needs: [test-matlab-stable]
5145
uses: ./.github/workflows/coverage-report.yml
52-
secrets: inherit
46+
secrets: inherit
47+
48+
event_file:
49+
name: Event File
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: Upload
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: event-file
56+
path: ${{ github.event_path }}

0 commit comments

Comments
 (0)