Skip to content

Commit 603aa3a

Browse files
authored
Refactor CI for forked repositories - codecov - bind to right commit/PR (#104)
1 parent f5420f9 commit 603aa3a

File tree

1 file changed

+49
-0
lines changed
  • .github/actions/reports-group/codecov-uploader

1 file changed

+49
-0
lines changed

.github/actions/reports-group/codecov-uploader/action.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,49 @@ inputs:
1212
description: |
1313
Indicates whether to follow symbolic links when resolving `path`
1414
default: 'true'
15+
override-commit:
16+
description: |
17+
Commit to link to the uploaded reports.
18+
Default value:
19+
- `push` and `pull_request` workflow: `github.event.after`
20+
- `workflow_run` workflow triggered by a `pull_request` or `push` workflow: `github.event.workflow_run.head_sha`
21+
default: "${{ ('workflow_run' == github.event_name && ('pull_request' == github.workflow_run.event || 'push' == github.workflow_run.event) && github.event.workflow_run.head_sha) || (('pull_request' == github.event_name || 'push' == github.event_name) && github.event.pull_request.head.sha) || null }}"
22+
override-branch:
23+
description: |
24+
Branch to link to the uploaded reports.
25+
Default value:
26+
- `push` workflow: `github.ref_name` *if `github.ref_type` equals `branch`
27+
- `pull_request` workflow: `github.event.pull_request.head.ref`
28+
- `workflow_run` workflow triggered by a `pull_request` or `push` workflow: `github.event.workflow_run.head_branch`
29+
default: "${{ ('workflow_run' == github.event_name && ('pull_request' == github.workflow_run.event || 'push' == github.workflow_run.event) && github.event.workflow_run.head_branch) || ('pull_request' == github.event_name && github.event.pull_request.head.ref) || ('push' == github.event_name && 'branch' == github.ref_type && github.sha) || null }}"
30+
override-pr:
31+
description: |
32+
PR to link to the uploaded reports.
33+
Default value:
34+
- `pull_request` workflow: `github.event.number`
35+
- `workflow_run` workflow triggered by a `pull_request` workflow: `github.event.workflow_run.pull_requests[0].number`
36+
default: "${{ ( 'workflow_run' == github.event_name && 'pull_request' == github.workflow_run.event && github.event.workflow_run.pull_requests[0] && github.event.workflow_run.pull_requests[0].number) || ('pull_request' == github.event_name && github.event.number) || null }}"
37+
# commit-parent: # @TODO Not sure what it is (enable debug mode during upload to see what is actually sent by the uploader)
38+
# description: |
39+
# Parent commit to link to the uploaded reports. Most likely only useful for PR.
40+
# Default value:
41+
# - `pull_request` workflow: `github.event.number`
42+
# - `workflow_run` workflow triggered by a `pull_request` workflow: `github.event.workflow_run.pull_requests[0].number`
43+
# default: "${{ ('workflow_run' == github.event_name && ('pull_request' == github.workflow_run.event || 'push' == github.workflow_run.event) && github.event.workflow_run.head_branch) || ('pull_request' == github.event_name && github.event.pull_request.head.ref) || ('push' == github.event_name && github.sha) || null }}"
44+
override-build:
45+
description: |
46+
Workflow run to link to the uploaded reports
47+
Default value:
48+
- `workflow_run` workflow: `github.event.workflow_run.id`
49+
- Else: `github.run_id`
50+
default: "${{ ('workflow_run' == github.event_name && github.event.workflow_run.id) || github.run_id || null }}"
51+
override-build-url:
52+
description: |
53+
Workflow run url to link to the uploaded reports
54+
Default value:
55+
- `workflow_run` workflow: `github.event.workflow_run.id`
56+
- Else: `github.run_id`
57+
default: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ ('workflow_run' == github.event_name && github.event.workflow_run.id) || github.run_id }}"
1558

1659
outputs:
1760
groups:
@@ -93,6 +136,12 @@ runs:
93136
name: ${{ steps.build-uploader-options.outputs.name }}
94137
files: ${{ steps.build-uploader-options.outputs.files }}
95138
flags: ${{ steps.build-uploader-options.outputs.flags }}
139+
commit_parent: ${{ inputs.commit-parent }}
140+
override_branch: ${{ inputs.override-branch }}
141+
override_commit: ${{ inputs.override-commit }}
142+
override_pr: ${{ inputs.override-pr }}
143+
override_build: ${{ inputs.override-build }}
144+
override_build_url: ${{ inputs.override-build-url }}
96145
# underlying CLI behavior
97146
disable_search: true
98147
# GHAction behavior

0 commit comments

Comments
 (0)