@@ -3,52 +3,47 @@ name: Test Report
33on :
44 workflow_run :
55 workflows : ["Test"]
6- types :
7- - completed
6+ types : [completed]
7+ branches : [main, develop] # ← don’t run for misc feature branches
8+
9+ permissions :
10+ contents : read
11+ actions : read # download upstream artifacts
12+ checks : write
813
914jobs :
15+ discover :
16+ runs-on : ubuntu-latest
17+ outputs :
18+ head_branch : ${{ steps.meta.outputs.branch }}
19+ head_sha : ${{ steps.meta.outputs.sha }}
20+ steps :
21+ - id : meta
22+ run : |
23+ echo "branch=${{ github.event.workflow_run.head_branch }}" >> "$GITHUB_OUTPUT"
24+ echo "sha=${{ github.event.workflow_run.head_sha }}" >> "$GITHUB_OUTPUT"
1025 report :
26+ needs : discover
1127 runs-on : ubuntu-latest
12-
1328 steps :
14-
15- # 🔍 Sanity-check: list everything the action just downloaded
16- - name : Show downloaded artifact contents
17- run : ls -R
18-
19- - name : Download .NET 9.0 Test Results
20- uses : dawidd6/action-download-artifact@v2
21- with :
22- workflow : Test
23- run_id : ${{ github.event.workflow_run.id }}
24- name : test-results-net9.0
25- path : ./TestResults/net9.0
26-
27- - name : Download .NET 8.0 Test Results
28- uses : dawidd6/action-download-artifact@v2
29- with :
30- workflow : Test
31- run_id : ${{ github.event.workflow_run.id }}
32- name : test-results-net8.0
33- path : ./TestResults/net8.0
34-
35- - name : Checkout Code
29+ # Checkout **the same commit** that the Test job ran on
30+ - name : Checkout code @ tested SHA
3631 uses : actions/checkout@v4
3732 with :
3833 fetch-depth : 0
34+ ref : ${{ needs.discover.outputs.head_sha }}
3935
40- - name : List Downloaded Files
41- run : |
42- echo "📂 Listing all downloaded artifact files..."
43- ls -R ./TestResults || echo "⚠️ No TestResults directory found"
36+ # Optional: sanity listing of what GitHub auto-downloaded
37+ - name : Show downloaded artifacts
38+ run : ls -R
4439
45- - name : Generate Combined Test Report
40+ # 📊 Publish report — let the action pull both artifacts
41+ - name : Generate combined test report
4642 uses : dorny/test-reporter@v1
4743 with :
48- artifact : |
49- test-results-net9.0
50- test-results-net8.0
51- name : Unit Tests (.NET 8 & 9)
44+ # regex matches both test-results-net8.0 and test-results-net9.0
45+ artifact : /test-results-net[89]\.0/
46+ name : " Unit Tests (.NET 8 & 9)"
5247 path : ' **/*.trx'
5348 reporter : dotnet-trx
5449 fail-on-error : false
0 commit comments