Skip to content

Commit 28fbd73

Browse files
authored
ci: fix test results not commenting on PRs (#2463)
Backport of #2462 to karaf-4.4.x. The publish-unit-test-result-action in workflow_run mode needs the original event payload file to identify the associated PR. The CI workflow was not uploading it, and the test-results workflow was referencing a non-existent property (github.event.workflow_run.event_path). Upload the event file as a separate artifact in CI and download it in the test-results workflow so the action can correctly post PR comments.
1 parent f89a316 commit 28fbd73

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

.github/workflows/ci-test-results.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,25 @@ jobs:
3838
if: github.event.workflow_run.conclusion != 'skipped'
3939

4040
steps:
41-
- name: Download and Extract Artifacts
41+
- name: Download Test Results
4242
uses: dawidd6/action-download-artifact@v19
4343
with:
4444
run_id: ${{ github.event.workflow_run.id }}
4545
name: test-results
4646
path: artifacts
4747

48+
- name: Download Event File
49+
uses: dawidd6/action-download-artifact@v19
50+
with:
51+
run_id: ${{ github.event.workflow_run.id }}
52+
name: event-file
53+
path: event
54+
4855
- name: Publish Test Results
4956
uses: EnricoMi/publish-unit-test-result-action@v2
5057
with:
5158
commit: ${{ github.event.workflow_run.head_sha }}
52-
event_file: ${{ github.event.workflow_run.event_path }}
59+
event_file: event/event.json
5360
event_name: ${{ github.event.workflow_run.event }}
5461
large_files: true
5562
report_individual_runs: true

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,9 @@ jobs:
8383
with:
8484
name: test-results
8585
path: '**/target/surefire-reports/*.xml'
86+
- name: Upload Event File
87+
if: always()
88+
uses: actions/upload-artifact@v7
89+
with:
90+
name: event-file
91+
path: ${{ github.event_path }}

0 commit comments

Comments
 (0)