-
Notifications
You must be signed in to change notification settings - Fork 12
367 lines (304 loc) · 12.7 KB
/
build.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
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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
---
name: Build
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: 0 0 * * 1
workflow_dispatch: null
permissions: {}
jobs:
deploy:
if: ${{ github.actor != 'dependabot[bot]' }}
name: Deploy
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: npm – Install
run: npm install
- name: npm – Build Release
run: npm run build:release
- name: Azure DevOps - Install TFX CLI
run: npm install -g tfx-cli
working-directory: ${{ github.workspace }}
- name: Azure DevOps - Sign-in
# Azure DevOps Personal Access Token (PAT) with the Agent Pools (Read & manage) permission.
run: npx tfx-cli login --service-url https://${{ secrets.AZDO_ACCOUNT }}.visualstudio.com/DefaultCollection --token ${{ secrets.AZDO_PAT }}
working-directory: ${{ github.workspace }}
- name: Azure DevOps – Delete Task
run: npx tfx-cli build tasks delete --task-id 907d3b28-6b37-4ac7-ac75-9631ee53e512 --no-prompt
continue-on-error: true
working-directory: ${{ github.workspace }}
- name: Azure DevOps – Deploy
run: npx tfx-cli build tasks upload --task-path release/task --no-prompt
working-directory: ${{ github.workspace }}
update-code:
name: Update Code
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ github.HEAD_REF }}
token: ${{ secrets.BUILD_UPDATE_CODE_CHECKOUT }}
- name: Install Node.js
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
with:
node-version: 21.x
- name: npm – Install Dependencies
run: npm install
- name: npm – Lint
run: npm run lint
- name: npm – Build Package
run: npm run build:package
- name: Git – Add Changed Files
run: git add -A
- name: Detect Changes
id: detect-changes
shell: pwsh
run: |-
$GitStatus = git status
Write-Output -InputObject $GitStatus
$NoChangesPresent = $GitStatus.Contains("nothing to commit, working tree clean")
Write-Output -InputObject $NoChangesPresent
Write-Output -InputObject "NO_CHANGES_PRESENT=$NoChangesPresent" >> $Env:GITHUB_OUTPUT
- if: ${{ steps.detect-changes.outputs.NO_CHANGES_PRESENT == 'False' }}
name: Git – Set Name
run: git config --global user.name "github-actions[bot]"
- if: ${{ steps.detect-changes.outputs.NO_CHANGES_PRESENT == 'False' }}
name: Git – Set Email
run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- if: ${{ steps.detect-changes.outputs.NO_CHANGES_PRESENT == 'False' }}
name: Git – Commit Changed Files
run: git commit -m "Fixing linting, Updating dist folder"
- if: ${{ steps.detect-changes.outputs.NO_CHANGES_PRESENT == 'False' }}
name: Git – Push Changed Files
run: git push
build:
name: Build
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Install Node.js
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
with:
node-version: 21.x
- name: npm – Install Dependencies
run: npm install
- name: npm – Test Clean
run: npm run clean
- name: npm – Build
run: npm run build
- name: npm – Test
run: npm run test
- name: Release - Install TFX CLI
run: npm install -g tfx-cli
working-directory: ${{ github.workspace }}/release
- name: Release – Create
run: npx tfx-cli extension create --manifest-globs vss-extension.json --output-path ../ms-omex.PRMetrics.vsix
working-directory: ${{ github.workspace }}/release
- name: Release – Upload
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: PRMetrics
path: ${{ github.workspace }}/ms-omex.PRMetrics.vsix
test-github-action:
name: Test GitHub Action
runs-on: ubuntu-latest
permissions:
pull-requests: write
statuses: write
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: PR Metrics
uses: ./
env:
PR_METRICS_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file-matching-patterns: |
**/*
!dist/*
!package-lock.json
validate:
name: Validate
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Validate Markdown Links
uses: gaurav-nelson/github-action-markdown-link-check@d53a906aa6b22b8979d33bc86170567e619495ec # 1.0.15
with:
config-file: .github/linters/markdown-link-check.json
- name: Validate babel.config.json
uses: walbo/validate-json@1c24a27a740a698944ff5b697cb8010a72c55c6b # v1.1.0
with:
files: babel.config.json
print-valid-files: true
strict: false
- name: Validate .markdownlint.json – Download .markdownlint.schema.json
shell: pwsh
run: Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/DavidAnson/markdownlint/main/schema/markdownlint-config-schema.json' -OutFile '.markdownlint.schema.json'
- name: Validate .markdownlint.json – Update .markdownlint.schema.json
shell: pwsh
run: |-
$FileContent = Get-Content -Path '.markdownlint.schema.json' -Raw
$FileContent = $FileContent -replace 'http://json-schema.org/draft-07/schema#', 'http://json-schema.org/draft-04/schema#'
Set-Content -NoNewline -Path '.markdownlint.schema.json' -Value $FileContent
- name: Validate .markdownlint.json
uses: walbo/validate-json@1c24a27a740a698944ff5b697cb8010a72c55c6b # v1.1.0
with:
files: .markdownlint.json
print-valid-files: true
schema: .markdownlint.schema.json
strict: false
- name: Validate devcontainer.json – Download devcontainer.schema.json
shell: pwsh
run: Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/microsoft/vscode/main/extensions/configuration-editing/schemas/devContainer.codespaces.schema.json' -OutFile 'devcontainer.schema.json'
- name: Validate devcontainer.json – Update devcontainer.schema.json
shell: pwsh
run: |-
$FileContent = Get-Content -Path 'devcontainer.schema.json' -Raw
$FileContent = $FileContent -replace 'http://json-schema.org/draft-07/schema#', 'http://json-schema.org/draft-04/schema#'
Set-Content -NoNewline -Path 'devcontainer.schema.json' -Value $FileContent
- name: Validate devcontainer.json
uses: walbo/validate-json@1c24a27a740a698944ff5b697cb8010a72c55c6b # v1.1.0
with:
files: .devcontainer/devcontainer.json
print-valid-files: true
strict: false
schema: devcontainer.schema.json
- name: Validate vss-extension.json – Download vss-extension.schema.json
shell: pwsh
run: Invoke-WebRequest -Uri 'https://json.schemastore.org/vss-extension.json' -OutFile 'vss-extension.schema.json'
- name: Validate vss-extension.json – Update vss-extension.schema.json
shell: pwsh
run: |-
$FileContent = Get-Content -Path 'vss-extension.schema.json' -Raw
$FileContent = $FileContent -replace 'http://json-schema.org/draft-07/schema#', 'http://json-schema.org/draft-04/schema#'
Set-Content -NoNewline -Path 'vss-extension.schema.json' -Value $FileContent
- name: Validate vss-extension.json
uses: walbo/validate-json@1c24a27a740a698944ff5b697cb8010a72c55c6b # v1.1.0
with:
files: src/vss-extension.json
print-valid-files: true
strict: false
schema: vss-extension.schema.json
- name: Validate task.json – Download task.schema.json
shell: pwsh
run: Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/microsoft/azure-pipelines-task-lib/master/tasks.schema.json' -OutFile 'task.schema.json'
- name: Validate task.json – Update task.schema.json
shell: pwsh
run: |-
$FileContent = Get-Content -Path 'task.schema.json' -Raw
$FileContent = $FileContent.replace('^connectedService\\:.+$', '^connectedService:.+$')
Set-Content -NoNewline -Path 'task.schema.json' -Value $FileContent
- name: Validate task.json
uses: walbo/validate-json@1c24a27a740a698944ff5b697cb8010a72c55c6b # v1.1.0
with:
files: src/task/task.json
print-valid-files: true
schema: task.schema.json
- name: Validate task.loc.json
uses: walbo/validate-json@1c24a27a740a698944ff5b697cb8010a72c55c6b # v1.1.0
with:
files: src/task/task.loc.json
print-valid-files: true
schema: task.schema.json
- name: Validate tsconfig.json
uses: walbo/validate-json@1c24a27a740a698944ff5b697cb8010a72c55c6b # v1.1.0
with:
files: src/task/tsconfig.json
print-valid-files: true
strict: false
- name: Validate typedoc.json – Download typedoc.schema.json
shell: pwsh
run: Invoke-WebRequest -Uri 'https://typedoc.org/schema.json' -OutFile 'typedoc.schema.json'
- name: Validate typedoc.json – Update typedoc.schema.json
shell: pwsh
run: |-
$FileContent = Get-Content -Path 'typedoc.schema.json' -Raw
$FileContent = $FileContent -replace 'https://json-schema.org/draft-07/schema', 'http://json-schema.org/draft-04/schema#'
Set-Content -NoNewline -Path 'typedoc.schema.json' -Value $FileContent
- name: Validate typedoc.json
uses: walbo/validate-json@1c24a27a740a698944ff5b697cb8010a72c55c6b # v1.1.0
with:
files: src/task/typedoc.json
print-valid-files: true
strict: false
schema: typedoc.schema.json
- name: Validate resources.resjson (en-US)
uses: walbo/validate-json@1c24a27a740a698944ff5b697cb8010a72c55c6b # v1.1.0
with:
files: src/task/Strings/resources.resjson/en-US/resources.resjson
print-valid-files: true
strict: false
validate-codeql:
name: Validate – CodeQL
runs-on: ubuntu-latest
permissions:
security-events: write
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Initialize
uses: github/codeql-action/init@b7bf0a3ed3ecfa44160715d7c442788f65f0f923 # v3.23.2
with:
config-file: .github/linters/codeql.yml
queries: security-and-quality
- name: Analyze
uses: github/codeql-action/analyze@b7bf0a3ed3ecfa44160715d7c442788f65f0f923 # v3.23.2
validate-linter:
name: Validate – Linter
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Install Node.js
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
with:
node-version: 21.x
- name: npm – Install Dependencies
run: npm install
- name: Super Linter
uses: github/super-linter@45fc0d88288beee4701c62761281edfee85655d7 # v5.0.0
env:
EDITORCONFIG_FILE_NAME: ../../.editorconfig
FILTER_REGEX_EXCLUDE: .*dist/.*
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITLEAKS_CONFIG_FILE: gitleaks.toml
MARKDOWN_CONFIG_FILE: ../../.markdownlint.json
TYPESCRIPT_ES_CONFIG_FILE: ../../.eslintrc.yml
VALIDATE_JAVASCRIPT_STANDARD: false
VALIDATE_TYPESCRIPT_STANDARD: false
dependabot:
if: ${{ github.actor == 'dependabot[bot]' }}
name: Dependabot
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Enable Auto-Merge
run: gh pr merge --auto --delete-branch --squash "${{ github.event.pull_request.html_url }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
...