Repository navigation
Expand file tree
/
Copy pathaction.yml
More file actions
117 lines (108 loc) · 4.68 KB
/
Copy pathaction.yml
File metadata and controls
117 lines (108 loc) · 4.68 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Quality Monitor
description: Action that monitors the quality of projects and pull requests.
inputs:
checks-name:
description: "Name of the GitHub checks (if not set the default name 'Quality Monitor' will be used)"
required: false
comments-strategy:
description: "How to handle subsequent comments (options: ADD, REMOVE, REPLACE)."
required: false
default: REMOVE
config:
description: "Quality monitor JSON configuration (if not set, a default configuration will be used)"
required: false
enable-delta:
description: "Automatically download reference reports from the main branch and compute delta metrics (if not set, no delta metrics will be computed)"
required: false
default: 'false'
github-api-url:
description: "GitHub API URL (GITHUB_API_URL)"
required: false
default: ${{github.api_url}}
github-token:
description: "GitHub authentication token (GITHUB_TOKEN)"
required: false
default: ${{github.token}}
log-comments:
description: "Log comment properties to the console (helps to debug comment creation issues)"
required: false
max-coverage-annotations:
description: "Limit the number of coverage annotations at specific lines. By default, all annotations are created."
required: false
max-warning-annotations:
description: "Limit the number of warning annotations at specific lines. By default, all annotations are created."
required: false
pr-number:
description: "Pull request number (if not set, PR comments will be skipped)"
required: false
quality-gates:
description: "Quality gates configuration as JSON (if not set, quality is only monitored but no quality gates will be evaluated)"
required: false
sha:
description: "Commit SHA to use for the quality check (if not set, GITHUB_SHA will be used)"
required: false
show-headers:
description: "Show headers for each subsection in the comment summary (if not set, headers are hidden)"
required: false
skip-annotations:
description: "Skip the creation of annotations (for warnings and missed coverage) if not empty"
required: false
title-metric:
description: "Metric to show in the GitHub check title (options: line, branch, instruction, mutation, etc., or none)"
required: false
runs:
using: composite
steps:
- name: Download reference reports from main branch
id: reference-download
if: ${{ inputs.enable-delta == 'true' }}
uses: dawidd6/action-download-artifact@v27
with:
branch: main
check_artifacts: true
if_no_artifact_found: ignore
name: quality-reports
path: reference-reports
workflow: quality-monitor-build.yml
- name: Create information links to the reference results
id: reference-info
if: ${{ inputs.enable-delta == 'true' }}
shell: bash
run: |
run_id=$(echo '${{ steps.reference-download.outputs.artifacts }}' | jq -r '.[0].workflow_run.id // "unknown"')
echo "run_id=$run_id" >> "$GITHUB_OUTPUT"
if [ "$run_id" != "unknown" ]; then
run_url="https://github.com/${{ github.repository }}/actions/runs/$run_id"
echo "run_url=$run_url" >> "$GITHUB_OUTPUT"
fi
head_sha=$(echo '${{ steps.reference-download.outputs.artifacts }}' | jq -r '.[0].workflow_run.head_sha // "unknown"')
echo "head_sha=$head_sha" >> "$GITHUB_OUTPUT"
if [ "$head_sha" != "unknown" ]; then
commit_url="https://github.com/${{ github.repository }}/commit/$head_sha"
echo "commit_url=$commit_url" >> "$GITHUB_OUTPUT"
fi
echo "Downloaded artifact from Run $run_id ($run_url)"
echo "Downloaded artifact from Commit SHA $head_sha ($commit_url)"
- name: Run Quality Monitor
id: report
uses: docker://ghcr.io/uhafner/quality-monitor:v4.16.0-SNAPSHOT
env:
CHECKS_NAME: ${{ inputs.checks-name }}
COMMENTS_STRATEGY: ${{ inputs.comments-strategy }}
COMMIT_URL: ${{ inputs.enable-delta == 'true' && steps.reference-info.outputs.commit_url }}
CONFIG: ${{ inputs.config }}
GITHUB_API_URL: ${{ inputs.github-api-url }}
GITHUB_TOKEN: ${{ inputs.github-token }}
LOG_COMMENTS: ${{ inputs.log-comments }}
MAX_COVERAGE_ANNOTATIONS: ${{ inputs.max-coverage-annotations }}
MAX_WARNING_ANNOTATIONS: ${{ inputs.max-warning-annotations }}
PR_NUMBER: ${{ inputs.pr-number }}
QUALITY_GATES: ${{ inputs.quality-gates }}
RUN_URL: ${{ inputs.enable-delta == 'true' && steps.reference-info.outputs.run_url }}
SHA: ${{ inputs.sha }}
SHOW_HEADERS: ${{ inputs.show-headers }}
SKIP_ANNOTATIONS: ${{ inputs.skip-annotations }}
TITLE_METRIC: ${{ inputs.title-metric }}
branding:
icon: check-square
color: green