-
Notifications
You must be signed in to change notification settings - Fork 21
239 lines (234 loc) · 8.14 KB
/
Copy pathpostCommit.yaml
File metadata and controls
239 lines (234 loc) · 8.14 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
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
name: post commit CI
on:
push:
paths:
- scripts/**/*.js
- scripts/**/*.yaml
- "!scripts/detectHardcodedOutdatedNPMPackages/*.js"
- "!scripts/detectHardcodedOutdatedNPMPackages/*.yaml"
- "!scripts/autoAssign/*.js"
- src/**/*.js
- src/**/*.css
- src/**/definition.yaml
- src/gadgets/Gadgets-definition-list.yaml
- .github/workflows/postCommit.yaml
- .vscode/json-schemas/gadget-definition.json
- .vscode/json-schemas/gadget-definition-per-site.json
- .browserslistrc
- .swcrc
- .*.yaml
- package-lock.json
# `npm run lint:scripts` 的检查目标(见 scripts/modules/lintTargets.js):
# 只改这些文件时也必须触发,否则 linter_test 里的该步骤不会运行。
- eslint.config.js
- commitlint.config.mjs
- .husky/**
merge_group:
pull_request:
paths:
- scripts/**/*.js
- scripts/**/*.yaml
- "!scripts/detectHardcodedOutdatedNPMPackages/*.js"
- "!scripts/detectHardcodedOutdatedNPMPackages/*.yaml"
- "!scripts/autoAssign/*.js"
- src/**/*.js
- src/**/*.css
- src/**/definition.yaml
- src/gadgets/Gadgets-definition-list.yaml
- .github/workflows/postCommit.yaml
- .vscode/json-schemas/gadget-definition.json
- .vscode/json-schemas/gadget-definition-per-site.json
- .browserslistrc
- .*.yaml
- package-lock.json
# `npm run lint:scripts` 的检查目标(见 scripts/modules/lintTargets.js):
# 只改这些文件时也必须触发,否则 linter_test 里的该步骤不会运行。
- eslint.config.js
- commitlint.config.mjs
- .husky/**
workflow_dispatch:
schedule:
- cron: 0 23 * * * # Every 07:00 CST
concurrency:
group: ${{ github.workflow_ref }}-${{ github.ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ANNBOT_USER_AGENT: ${{ secrets.ANNBOT_USER_AGENT }}
permissions:
actions: write
checks: read
contents: write
deployments: read
issues: write
discussions: read
packages: read
pages: read
pull-requests: write
repository-projects: read
security-events: write
statuses: write
jobs:
skipCI:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
show-progress: false
- name: Use Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
with:
node-version: lts/*
check-latest: true
cache: npm
- name: Installing the dependencies
uses: AnnAngela/cached_node-modules@095ea9ae366bc4a18c0f653aed2008d35660317d # v6
with:
command: npm run ci
- name: If needs to skip, skip now
run: node scripts/skip/index.js
id: skip
outputs:
skip: ${{ steps.skip.outputs.skip }}
postCommit:
runs-on: ubuntu-latest
needs:
- skipCI
if: always() && needs.skipCI.result == 'success' && needs.skipCI.outputs.skip != 'true'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
name: Checkout main repo
with:
fetch-depth: 0
show-progress: false
- name: Use Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
with:
node-version: lts/*
check-latest: true
cache: npm
- name: Installing the dependencies
uses: AnnAngela/cached_node-modules@095ea9ae366bc4a18c0f653aed2008d35660317d # v6
with:
command: npm run ci
- name: Git config
run: node scripts/postCommit/prepareGit.js
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@04d248b84655b509d8c44dc1d6f990c879747487 # v4
- name: Auto browserify generator
run: node scripts/browserify/index.js
- name: Auto prefetch
run: node scripts/prefetch/index.js
- name: Gadgets-definition Generator
run: node scripts/generateGadgetsDefinition/index.js
- name: Conventional Commits scopes generator
run: node scripts/generateConventionalCommitsScopes/index.js
- name: User Rights Schema generator
run: node scripts/generateUserRightsSchema/index.js
- name: Commits History generator
run: node scripts/generateCommitsHistory/index.js
- name: linguist-generated
run: node scripts/postCommit/linguist-generated.js
- name: Show git status & push
run: node scripts/postCommit/push.js
linter_test:
runs-on: ubuntu-latest
needs:
- skipCI
- postCommit
if: always() && needs.skipCI.result == 'success' && needs.skipCI.outputs.skip != 'true'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
show-progress: false
- name: Use Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
with:
node-version: lts/*
check-latest: true
cache: npm
- name: Installing the dependencies
uses: AnnAngela/cached_node-modules@095ea9ae366bc4a18c0f653aed2008d35660317d # v6
with:
command: npm run ci
- name: Reload the linter cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .cache
key: cache@${{ github.ref }}
- name: Check environment
run: |
npx eslint --env-info
echo ----
echo "stylelint: "
npx stylelint --version
echo ----
echo "v8r: "
npx v8r --version
echo ----
mkdir -vp .cache
echo ".cache:"
ls -lhA .cache
- name: Run eslint
run: npm run test:eslint -- --format @annangela/eslint-formatter-gha
- name: Run eslint for scripts and config files
run: npm run lint:scripts -- --format @annangela/eslint-formatter-gha
- name: Run stylelint
run: npm run test:stylelint -- --custom-formatter=@csstools/stylelint-formatter-github
- name: Run v8r
run: npx v8r
- name: Run postcss test
run: node scripts/postcss/index.js
- name: Check .mailmap
if: needs.postCommit.result == 'success'
run: node scripts/emailmapChecker/index.js
notifyPrFailure:
runs-on: ubuntu-latest
needs:
- skipCI
- postCommit
- linter_test
if: always() && needs.skipCI.result == 'success' && needs.skipCI.outputs.skip != 'true' && (needs.postCommit.result == 'failure' || needs.linter_test.result == 'failure')
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
show-progress: false
- name: Use Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
with:
node-version: lts/*
check-latest: true
cache: npm
- name: Installing the dependencies
uses: AnnAngela/cached_node-modules@095ea9ae366bc4a18c0f653aed2008d35660317d # v6
with:
command: npm run ci
- name: Comment the failure to the relative pull request
run: node scripts/postCommit/commentOnPrFailure.js
env:
NEEDS: ${{ toJson(needs) }}
webhook:
runs-on: ubuntu-latest
needs:
- skipCI
- postCommit
- linter_test
if: always() && needs.skipCI.outputs.skip != 'true' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
show-progress: false
- name: Use Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
with:
node-version: lts/*
check-latest: true
cache: npm
- name: Installing the dependencies
uses: AnnAngela/cached_node-modules@095ea9ae366bc4a18c0f653aed2008d35660317d # v6
with:
command: npm run ci
- name: Fire the webhook of AnnAngela's server
run: node scripts/fireWebhook/index.js
env:
needs: ${{ toJson(needs) }}
ANN_SERVER_SECRET_API_KEY: ${{ secrets.ANN_SERVER_SECRET_API_KEY }}