-
Notifications
You must be signed in to change notification settings - Fork 15
196 lines (191 loc) · 6.1 KB
/
postCommit.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
name: post commit CI
on:
push:
paths:
- scripts/**/*.js
- scripts/**/*.yaml
- "!scripts/test/*.js"
- "!scripts/generatePolyfill/*.js"
- "!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
- .browserslistrc
- .*.yaml
- package-lock.json
merge_group:
pull_request:
paths:
- scripts/**/*.js
- scripts/**/*.yaml
- "!scripts/test/*.js"
- "!scripts/generatePolyfill/*.js"
- "!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
- .browserslistrc
- .*.yaml
- package-lock.json
workflow_dispatch:
schedule:
- cron: 0 23 * * * # Every 07:00 CST
concurrency:
group: ${{ github.workflow_ref }}-${{ github.ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
actions: read
checks: read
contents: write
deployments: read
issues: write
discussions: read
packages: read
pages: read
pull-requests: read
repository-projects: read
security-events: write
statuses: write
jobs:
skipCI:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
show-progress: false
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
check-latest: true
cache: npm
- name: Installing the dependencies
uses: AnnAngela/cached_node-modules@v2
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@v4
name: Checkout main repo
with:
fetch-depth: 0
show-progress: false
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
check-latest: true
cache: npm
- name: Installing the dependencies
uses: AnnAngela/cached_node-modules@v2
with:
command: npm run ci
- name: Git config
run: node scripts/postCommit/prepareGit.js
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
- 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: Commits History generator
run: node scripts/generateCommitsHistory/index.js
- name: linguist-generated
run: node scripts/postCommit/linguist-generated.js
- name: Show git status & push
id: output
run: node scripts/postCommit/push.js
outputs:
commits: ${{ steps.output.outputs.commits }}
linterTest: ${{ steps.output.outputs.linterTest }}
linter_test:
runs-on: ubuntu-latest
needs:
- skipCI
- postCommit
if: always() && needs.skipCI.result == 'success' && needs.skipCI.outputs.skip != 'true'
env:
commits: ${{ needs.postCommit.outputs.commits }}
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
check-latest: true
cache: npm
- name: Installing the dependencies
uses: AnnAngela/cached_node-modules@v2
with:
command: npm run ci
- name: Reload the linter cache
uses: actions/cache@v4
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: npx eslint --cache --cache-strategy content --cache-location ".cache/" --exit-on-fatal-error --format @annangela/eslint-formatter-gha --max-warnings 0 ./src
- name: Run stylelint
run: npx stylelint --cache --cache-strategy content --cache-location ".cache/" --custom-formatter=stylelint-actions-formatters --max-warnings 0 "src/**/*.css"
- 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
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@v4
with:
show-progress: false
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
check-latest: true
cache: npm
- name: Installing the dependencies
uses: AnnAngela/cached_node-modules@v2
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 }}