-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathaction.yml
More file actions
74 lines (69 loc) · 2.91 KB
/
Copy pathaction.yml
File metadata and controls
74 lines (69 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: 'Upload Code Coverage'
description: 'Upload a Cobertura XML coverage report to GitHub code coverage API'
inputs:
file:
description: 'Path to the Cobertura XML coverage report'
required: true
language:
description: 'Linguist language name (e.g. "Java", "Go", "Python")'
required: true
label:
description: 'Label for the coverage report (e.g. "code-coverage/jacoco")'
required: true
fail-on-error:
description: 'Whether to fail the workflow step if the upload fails (set to false to treat upload errors as warnings)'
required: false
default: 'true'
wait-for-processing-timeout:
description: 'How many seconds to wait for coverage report processing before failing the step. Set to 0 to disable waiting'
required: false
default: '160'
token:
description: 'GitHub token with code-quality:write permission'
required: false
default: ${{ github.token }}
runs:
using: composite
steps:
- name: Check coverage upload eligibility
id: eligibility
shell: bash
env:
GH_TOKEN: ${{ inputs.token }}
COVERAGE_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
COVERAGE_PR_HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}
COVERAGE_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
COVERAGE_PR_NUMBER: ${{ github.event.pull_request.number }}
run: python3 "$GITHUB_ACTION_PATH/resolve_upload_context.py"
- name: Upload coverage report
if: steps.eligibility.outputs.should_upload == 'true'
shell: bash
env:
GH_TOKEN: ${{ inputs.token }}
INPUT_FILE: ${{ inputs.file }}
INPUT_LANGUAGE: ${{ inputs.language }}
INPUT_LABEL: ${{ inputs.label }}
FAIL_ON_ERROR: ${{ inputs.fail-on-error }}
WAIT_FOR_PROCESSING_TIMEOUT: ${{ inputs.wait-for-processing-timeout }}
GITHUB_EVENT_NAME: ${{ github.event_name }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_API_URL: ${{ github.api_url }}
COMMIT_OID: ${{ steps.eligibility.outputs.commit_oid }}
REF: ${{ steps.eligibility.outputs.ref }}
PR_NUMBER: ${{ steps.eligibility.outputs.pr_number }}
run: |
set -euo pipefail
python3 "$GITHUB_ACTION_PATH/upload_coverage.py"
- name: Post-step telemetry
if: always() && steps.eligibility.outputs.should_upload == 'true' && env._COVERAGE_TELEMETRY_STARTED_AT != ''
shell: bash
env:
GH_TOKEN: ${{ inputs.token }}
INPUT_LANGUAGE: ${{ inputs.language }}
INPUT_LABEL: ${{ inputs.label }}
FAIL_ON_ERROR: ${{ inputs.fail-on-error }}
WAIT_FOR_PROCESSING_TIMEOUT: ${{ inputs.wait-for-processing-timeout }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_API_URL: ${{ github.api_url }}
COMMIT_OID: ${{ steps.eligibility.outputs.commit_oid }}
run: python3 "$GITHUB_ACTION_PATH/post_upload_coverage.py"