-
Notifications
You must be signed in to change notification settings - Fork 6
198 lines (180 loc) · 6.36 KB
/
health.yaml
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# A CI configuration to check PR health.
name: Health
# Callers of this workflow should use it as follows:
#
# name: Health
# on:
# pull_request:
# branches: [ main ]
# types: [opened, synchronize, reopened, labeled, unlabeled]
# jobs:
# health:
# uses: dart-lang/ecosystem/.github/workflows/health.yaml@main
# with:
# coverage_web: true #If the coverage should run browser tests
# Callers may optionally specify the version of the SDK to use when running the
# health check. This can be useful if your package has a very recent minimum SDK
# constraint. This is done via the `sdk` input parameter. Note that this
# parameter is not required; it defaults to `stable` - using the most recent
# stable release of the Dart SDK.
#
# The checks can also be restricted to any subset of version, changelog, and license,
# if needed.
#
# jobs:
# health:
# uses: dart-lang/ecosystem/.github/workflows/health.yaml@main
# with:
# sdk: beta
# checks: "version,changelog,license,coverage,breaking,do-not-submit"
on:
workflow_call:
inputs:
sdk:
description: >-
The channel, or a specific version from a channel, to install
('2.19.0','stable', 'beta', 'dev'). Using one of the three channels
will give you the latest version published to that channel.
default: "stable"
required: false
type: string
checks:
description: What to check for in the PR health check - any subset of "version,changelog,license,coverage,breaking,do-not-submit"
default: "version,changelog,license,coverage,breaking,do-not-submit"
type: string
required: false
fail_on:
description: Which checks should lead to failure - any subset of "version,changelog,license,coverage,breaking,do-not-submit"
default: "version,changelog,do-not-submit"
type: string
required: false
warn_on:
description: Which checks should not fail, but only warn - any subset of "version,changelog,license,coverage,breaking,do-not-submit"
default: "license,coverage,breaking"
type: string
required: false
local_debug:
description: Whether to use a local copy of package:firehose - only for debug
default: false
type: boolean
required: false
upload_coverage:
description: Whether to upload the coverage to coveralls
default: true
type: boolean
required: false
coverage_web:
description: Whether to run `dart test -p chrome` for coverage
default: false
type: boolean
required: false
use-flutter:
description: >-
Whether to setup Flutter in this workflow.
default: false
required: false
type: boolean
jobs:
version:
name: health:version
if: contains(${{ inputs.checks }}, 'version')
uses: .github/workflows/health_base.yaml
with:
sdk: ${{ inputs.sdk }}
checks: version
fail_on: ${{ inputs.fail_on }}
warn_on: ${{ inputs.warn_on }}
local_debug: ${{ inputs.local_debug }}
use-flutter: ${{ inputs.use-flutter }}
changelog:
name: health:changelog
if: contains(${{ inputs.checks }}, 'changelog')
uses: .github/workflows/health_base.yaml
with:
sdk: ${{ inputs.sdk }}
checks: changelog
fail_on: ${{ inputs.fail_on }}
warn_on: ${{ inputs.warn_on }}
local_debug: ${{ inputs.local_debug }}
use-flutter: ${{ inputs.use-flutter }}
license:
name: health:license
if: contains(${{ inputs.checks }}, 'license')
uses: .github/workflows/health_base.yaml
with:
sdk: ${{ inputs.sdk }}
checks: license
fail_on: ${{ inputs.fail_on }}
warn_on: ${{ inputs.warn_on }}
local_debug: ${{ inputs.local_debug }}
use-flutter: ${{ inputs.use-flutter }}
coverage:
name: health:coverage
if: contains(${{ inputs.checks }}, 'coverage')
uses: .github/workflows/health_base.yaml
with:
sdk: ${{ inputs.sdk }}
checks: coverage
fail_on: ${{ inputs.fail_on }}
warn_on: ${{ inputs.warn_on }}
upload_coverage: ${{ inputs.upload_coverage }}
coverage_web: ${{ inputs.coverage_web }}
local_debug: ${{ inputs.local_debug }}
use-flutter: ${{ inputs.use-flutter }}
breaking:
name: health:breaking
if: contains(${{ inputs.checks }}, 'breaking')
uses: .github/workflows/health_base.yaml
with:
sdk: ${{ inputs.sdk }}
checks: breaking
fail_on: ${{ inputs.fail_on }}
warn_on: ${{ inputs.warn_on }}
local_debug: ${{ inputs.local_debug }}
use-flutter: ${{ inputs.use-flutter }}
do-not-submit:
name: health:do-not-submit
if: contains(${{ inputs.checks }}, 'do-not-submit')
uses: .github/workflows/health_base.yaml
with:
sdk: ${{ inputs.sdk }}
checks: do-not-submit
fail_on: ${{ inputs.fail_on }}
warn_on: ${{ inputs.warn_on }}
local_debug: ${{ inputs.local_debug }}
use-flutter: ${{ inputs.use-flutter }}
comment:
needs: [version, changelog, license, coverage, breaking, do-not-submit]
# These permissions are required for us to create comments on PRs.
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Download All Artifacts
uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110
with:
path: single-comments
pattern: comment-*
merge-multiple: true
- run: ls -R single-comments
- name: Find Comment
uses: peter-evans/find-comment@4541d1b6b0e618acc24284e118743fc5ad0bc5de
id: fc
with:
issue-number: ${{ github.event.number }}
comment-author: github-actions[bot]
body-includes: '## PR Health'
- name: Write comment id to file
if: ${{ steps.fc.outputs.comment-id == 0 }}
run: echo ${{ steps.fc.outputs.comment-id }} >> output/commentId
- name: Merge all single comments
run: |
mkdir output
echo $'## PR Health \n\n' >> output/comment.md
cat single-comments/* >> output/comment.md
echo ${{ github.event.number }} > output/issueNumber
- name: Upload folder with number and markdown
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392
with:
name: output
path: output/