File tree Expand file tree Collapse file tree 3 files changed +78
-0
lines changed Expand file tree Collapse file tree 3 files changed +78
-0
lines changed Original file line number Diff line number Diff line change 1+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-workflows-task.md
2+ name : Check Workflows
3+
4+ env :
5+ # See: https://github.com/actions/setup-node/#readme
6+ NODE_VERSION : 16.x
7+
8+ # See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
9+ on :
10+ push :
11+ paths :
12+ - " .github/workflows/*.ya?ml"
13+ - " package.json"
14+ - " package-lock.json"
15+ - " Taskfile.ya?ml"
16+ pull_request :
17+ paths :
18+ - " .github/workflows/*.ya?ml"
19+ - " package.json"
20+ - " package-lock.json"
21+ - " Taskfile.ya?ml"
22+ schedule :
23+ # Run every Tuesday at 8 AM UTC to catch breakage resulting from changes to the JSON schema.
24+ - cron : " 0 8 * * TUE"
25+ workflow_dispatch :
26+ repository_dispatch :
27+
28+ jobs :
29+ validate :
30+ runs-on : ubuntu-latest
31+
32+ steps :
33+ - name : Checkout repository
34+ uses : actions/checkout@v3
35+
36+ - name : Setup Node.js
37+ uses : actions/setup-node@v3
38+ with :
39+ node-version : ${{ env.NODE_VERSION }}
40+
41+ - name : Install Task
42+ uses : arduino/setup-task@v1
43+ with :
44+ repo-token : ${{ secrets.GITHUB_TOKEN }}
45+ version : 3.x
46+
47+ - name : Validate workflows
48+ run : task --silent ci:validate
Original file line number Diff line number Diff line change 1010[ ![ Check Python status] ( https://github.com/arduino/compile-sketches/actions/workflows/check-python-task.yml/badge.svg )] ( https://github.com/arduino/compile-sketches/actions/workflows/check-python-task.yml )
1111[ ![ Check Taskfiles status] ( https://github.com/arduino/compile-sketches/actions/workflows/check-taskfiles.yml/badge.svg )] ( https://github.com/arduino/compile-sketches/actions/workflows/check-taskfiles.yml )
1212[ ![ Check ToC status] ( https://github.com/arduino/compile-sketches/actions/workflows/check-toc-task.yml/badge.svg )] ( https://github.com/arduino/compile-sketches/actions/workflows/check-toc-task.yml )
13+ [ ![ Check Workflows status] ( https://github.com/arduino/compile-sketches/actions/workflows/check-workflows-task.yml/badge.svg )] ( https://github.com/arduino/compile-sketches/actions/workflows/check-workflows-task.yml )
1314[ ![ Spell Check status] ( https://github.com/arduino/compile-sketches/actions/workflows/spell-check-task.yml/badge.svg )] ( https://github.com/arduino/compile-sketches/actions/workflows/spell-check-task.yml )
1415[ ![ Sync Labels status] ( https://github.com/arduino/compile-sketches/actions/workflows/sync-labels-npm.yml/badge.svg )] ( https://github.com/arduino/compile-sketches/actions/workflows/sync-labels-npm.yml )
1516[ ![ Test Python status] ( https://github.com/arduino/compile-sketches/actions/workflows/test-python-poetry-task.yml/badge.svg )] ( https://github.com/arduino/compile-sketches/actions/workflows/test-python-poetry-task.yml )
Original file line number Diff line number Diff line change 1111 desc : Check for problems with the project
1212 deps :
1313 - task : action:validate
14+ - task : ci:validate
1415 - task : general:check-formatting
1516 - task : general:check-spelling
1617 - task : markdown:check-links
@@ -53,6 +54,34 @@ tasks:
5354 -s "{{.ACTION_METADATA_SCHEMA_PATH}}" \
5455 -d "action.yml"
5556
57+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-workflows-task/Taskfile.yml
58+ ci:validate :
59+ desc : Validate GitHub Actions workflows against their JSON schema
60+ vars :
61+ # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-workflow.json
62+ WORKFLOW_SCHEMA_URL : https://json.schemastore.org/github-workflow
63+ WORKFLOW_SCHEMA_PATH :
64+ sh : task utility:mktemp-file TEMPLATE="workflow-schema-XXXXXXXXXX.json"
65+ WORKFLOWS_DATA_PATH : " ./.github/workflows/*.{yml,yaml}"
66+ deps :
67+ - task : npm:install-deps
68+ cmds :
69+ - |
70+ wget \
71+ --quiet \
72+ --output-document="{{.WORKFLOW_SCHEMA_PATH}}" \
73+ {{.WORKFLOW_SCHEMA_URL}}
74+ - |
75+ npx \
76+ --package=ajv-cli \
77+ --package=ajv-formats \
78+ ajv validate \
79+ --all-errors \
80+ --strict=false \
81+ -c ajv-formats \
82+ -s "{{.WORKFLOW_SCHEMA_PATH}}" \
83+ -d "{{.WORKFLOWS_DATA_PATH}}"
84+
5685 docs:generate :
5786 desc : Create all generated documentation content
5887 # This is an "umbrella" task used to call any documentation generation processes the project has.
You can’t perform that action at this time.
0 commit comments