-
Notifications
You must be signed in to change notification settings - Fork 2
/
action.yml
77 lines (67 loc) · 2.62 KB
/
action.yml
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
75
76
77
name: 'Go Unit Test Coverage Report'
description: 'Post Go code coverage reports to pull requests.'
author: "Friedrich Große"
branding:
icon: 'umbrella'
color: 'blue'
inputs:
version:
description: 'The exact version tag of the go-coverage-report tool to use.'
required: true
default: "v1.0.1"
sha256sum:
description: 'Optional SHA256 checksum of the tarball when downloading the go-coverage-report binary.'
required: false
coverage-artifact-name:
description: 'The name of the artifact containing the code coverage results.'
required: true
default: "code-coverage"
coverage-file-name:
description: 'The name of the file containing the code coverage results.'
required: true
default: "coverage.txt"
root-package:
description: |
The Go import path of the tested repository to add as a prefix to all paths of the
changed files. This is useful to map the changed files (e.g., ["foo/my_file.go"]
to their coverage profile which uses the full package name to identify the files
(e.g., "github.com/fgrosse/example/foo/my_file.go"). Note that currently,
packages with a different name than their directory are not supported.
required: false
default: "github.com/${{ github.repository }}"
trim:
description: Trim a prefix in the "Impacted Packages" column of the markdown report.
required: false
runs:
using: "composite"
steps:
- name: Download go-coverage-report
shell: bash
id: download
run: $GITHUB_ACTION_PATH/scripts/download-cli-tool.sh "${{ inputs.version }}" "${{ inputs.sha256sum }}"
env:
RUNNER_OS: ${{ runner.os }}
RUNNER_ARCH: ${{ runner.arch }}
- name: Determine changed files
id: changed-files
uses: tj-actions/changed-files@aa08304bd477b800d468db44fe10f6c61f7f7b11 # v42.1.0
with:
write_output_files: true
json: true
files: |
**.go
files_ignore: |
vendor/**
- name: Code coverage report
shell: bash
run: $GITHUB_ACTION_PATH/scripts/github-action.sh "${{ github.repository }}" "${{ github.event.pull_request.number }}" "${{ github.run_id }}"
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
GITHUB_WORKFLOW: ${{ github.workflow }}
GITHUB_BASE_REF: ${{ github.base_ref }}
CHANGED_FILES_PATH: .github/outputs/all_changed_files.json
COVERAGE_ARTIFACT_NAME: ${{ inputs.coverage-artifact-name }}
COVERAGE_FILE_NAME: ${{ inputs.coverage-file-name }}
ROOT_PACKAGE: ${{ inputs.root-package }}
TRIM_PACKAGE: ${{ inputs.trim }}