File tree Expand file tree Collapse file tree 2 files changed +61
-0
lines changed Expand file tree Collapse file tree 2 files changed +61
-0
lines changed Original file line number Diff line number Diff line change 1+ # Source: https://github.com/arduino/tooling-project-assets/blob/master/workflow-templates/check-workflows-task.md
2+ name : Check Workflows
3+
4+ # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
5+ on :
6+ push :
7+ paths :
8+ - " .github/workflows/*.ya?ml"
9+ - " Taskfile.ya?ml"
10+ pull_request :
11+ paths :
12+ - " .github/workflows/*.ya?ml"
13+ - " Taskfile.ya?ml"
14+ schedule :
15+ # Run every Tuesday at 8 AM UTC to catch breakage resulting from changes to the JSON schema.
16+ - cron : " 0 8 * * TUE"
17+ workflow_dispatch :
18+ repository_dispatch :
19+
20+ jobs :
21+ validate :
22+ runs-on : ubuntu-latest
23+
24+ steps :
25+ - name : Checkout repository
26+ uses : actions/checkout@v2
27+
28+ - name : Install Task
29+ uses : arduino/setup-task@v1
30+ with :
31+ repo-token : ${{ secrets.GITHUB_TOKEN }}
32+ version : 3.x
33+
34+ - name : Validate workflows
35+ run : task --silent ci:validate
Original file line number Diff line number Diff line change @@ -129,3 +129,29 @@ tasks:
129129 exit $STATUS
130130 '
131131 fi
132+
133+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-workflows-task/Taskfile.yml
134+ ci:validate :
135+ desc : Validate GitHub Actions workflows against their JSON schema
136+ vars :
137+ # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-workflow.json
138+ WORKFLOW_SCHEMA_URL : https://json.schemastore.org/github-workflow
139+ WORKFLOW_SCHEMA_PATH :
140+ sh : mktemp -t workflow-schema-XXXXXXXXXX.json
141+ WORKFLOWS_DATA_PATH : " ./.github/workflows/*.{yml,yaml}"
142+ cmds :
143+ - |
144+ wget \
145+ --quiet \
146+ --output-document="{{.WORKFLOW_SCHEMA_PATH}}" \
147+ {{.WORKFLOW_SCHEMA_URL}}
148+ - |
149+ npx \
150+ --package=ajv-cli \
151+ --package=ajv-formats \
152+ ajv validate \
153+ --all-errors \
154+ --strict=false \
155+ -c ajv-formats \
156+ -s "{{.WORKFLOW_SCHEMA_PATH}}" \
157+ -d "{{.WORKFLOWS_DATA_PATH}}"
You can’t perform that action at this time.
0 commit comments