Skip to content

Commit 14983d7

Browse files
committed
Use npm to manage "Check Workflows" tool dependencies
The project uses the ajv-cli tool to validate GitHub Actions workflows against the JSON schema. Previously, the version of the tool used was not controlled. This was problematic because: - A different version of the tool may be used on the contributor's machine than on the CI runner, resulting in confusing failures. - The project is immediately subject to disruption or breakage resulting from a release of the tool. The new approach is to specify the version of the tools via the standard npm metadata files (package.json + package-lock.json), providing the following benefits: - Enables automated updates via Dependabot PRs - Enables automated vulnerability alerts
1 parent 7a66fef commit 14983d7

File tree

4 files changed

+290
-0
lines changed

4 files changed

+290
-0
lines changed

.github/workflows/check-workflows-task.yml

+11
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,16 @@ on:
66
push:
77
paths:
88
- ".github/workflows/*.ya?ml"
9+
- "**/.npmrc"
10+
- "package.json"
11+
- "package-lock.json"
912
- "Taskfile.ya?ml"
1013
pull_request:
1114
paths:
1215
- ".github/workflows/*.ya?ml"
16+
- "**/.npmrc"
17+
- "package.json"
18+
- "package-lock.json"
1319
- "Taskfile.ya?ml"
1420
schedule:
1521
# Run every Tuesday at 8 AM UTC to catch breakage resulting from changes to the JSON schema.
@@ -27,6 +33,11 @@ jobs:
2733
- name: Checkout repository
2834
uses: actions/checkout@v4
2935

36+
- name: Setup Node.js
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version-file: package.json
40+
3041
- name: Install Task
3142
uses: arduino/setup-task@v2
3243
with:

Taskfile.yml

+2
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ tasks:
119119
WORKFLOW_SCHEMA_PATH:
120120
sh: mktemp -t workflow-schema-XXXXXXXXXX.json
121121
WORKFLOWS_DATA_PATH: "./.github/workflows/*.{yml,yaml}"
122+
deps:
123+
- task: npm:install-deps
122124
cmds:
123125
- |
124126
wget \

package-lock.json

+275
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"devDependencies": {
3+
"ajv-cli": "5.0.0",
4+
"ajv-formats": "3.0.1",
35
"markdown-link-check": "3.12.2",
46
"markdownlint-cli": "0.42.0",
57
"prettier": "3.3.3"

0 commit comments

Comments
 (0)