1
1
name : Test Report
2
- run-name : Generate Test Report for workflow ${{ github.event.workflow_run.name }} run ${{ github.event.workflow_run.run_number }} branch ${{ github.event.workflow_run.head_branch }}
3
-
4
- # https://github.com/dorny/test-reporter#recommended-setup-for-public-repositories
5
- # This workflow is for test report
6
2
3
+ # ########################################################################
4
+ # TRIGGERS
5
+ # ########################################################################
7
6
on :
7
+ # ① Automatic – when the Test workflow ends on main / develop
8
8
workflow_run :
9
- workflows : [ "Test" ]
10
- types :
11
- - completed
12
-
9
+ workflows : ["Test"]
10
+ types : [completed]
11
+ branches : [main, develop]
12
+ workflow_dispatch :
13
+ inputs :
14
+ test_run_id :
15
+ description : " Run ID of the completed Test workflow (see the URL)"
16
+ required : true
17
+ type : string
18
+ branch :
19
+ description : " Branch that Test was run on"
20
+ required : true
21
+ type : choice
22
+ options : [main, develop]
23
+ default : develop
13
24
permissions :
14
25
contents : read
15
- actions : read
16
- checks : write
26
+ actions : read
27
+ checks : write
28
+
17
29
18
30
jobs :
19
- report :
31
+ discover-auto :
32
+ if : ${{ github.event_name == 'workflow_run' }} # ← auto only
20
33
runs-on : ubuntu-latest
34
+ outputs :
35
+ branch_name : ${{ steps.meta.outputs.branch }}
36
+ sha : ${{ steps.meta.outputs.sha }}
37
+ run_id : ${{ steps.meta.outputs.run_id }}
21
38
steps :
22
- - name : Test Report 🧪
23
- uses : dorny/test-reporter@v1
24
- with :
25
- artifact : test-results
26
- name : Unit Tests
27
- path : " *.trx"
28
- reporter : dotnet-trx
29
- fail-on-error : false
39
+ - id : meta
40
+ run : |
41
+ echo "branch=${{ github.event.workflow_run.head_branch }}" >> "$GITHUB_OUTPUT"
42
+ echo "sha=${{ github.event.workflow_run.head_sha }}" >> "$GITHUB_OUTPUT"
43
+ echo "run_id=${{ github.event.workflow_run.id }}" >> "$GITHUB_OUTPUT"
44
+
45
+ report-auto-main :
46
+ needs : discover-auto
47
+ if : ${{ needs.discover-auto.outputs.branch_name == 'main' }}
48
+ uses : Stillpoint-Software/shared-workflows/.github/workflows/test-report.yml@main
49
+ with :
50
+ test_run_id : ${{ needs.discover-auto.outputs.run_id }} # empty string is fine; shared workflow ignores in auto mode
51
+ secrets : inherit
52
+
53
+ report-auto-develop :
54
+ needs : discover-auto
55
+ if : ${{ needs.discover-auto.outputs.branch_name == 'develop' }}
56
+ uses : Stillpoint-Software/shared-workflows/.github/workflows/test-report.yml@develop
57
+ with :
58
+ test_run_id : ${{ needs.discover-auto.outputs.run_id }}
59
+ secrets : inherit
60
+
61
+ report-manual-main :
62
+ if : ${{ github.event_name == 'workflow_dispatch' && inputs.branch == 'main' }}
63
+ uses : Stillpoint-Software/shared-workflows/.github/workflows/test-report.yml@main
64
+ with :
65
+ test_run_id : ${{ inputs.test_run_id }}
66
+ branch : main
67
+ secrets : inherit
68
+
69
+ report-manual-develop :
70
+ if : ${{ github.event_name == 'workflow_dispatch' && inputs.branch == 'develop' }}
71
+ uses : Stillpoint-Software/shared-workflows/.github/workflows/test-report.yml@develop
72
+ with :
73
+ test_run_id : ${{ inputs.test_run_id }}
74
+ branch : develop
75
+ secrets : inherit
0 commit comments