Skip to content

Commit 88f3647

Browse files
authored
Merge pull request #14 from arduino/scerza/check-taskfile
Add CI workflow to validate Taskfiles
2 parents b8f9093 + b2001dd commit 88f3647

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-taskfiles.md
2+
name: Check Taskfiles
3+
4+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
5+
on:
6+
push:
7+
paths:
8+
- ".github/workflows/check-taskfiles.ya?ml"
9+
- "**/Taskfile.ya?ml"
10+
- "**/DistTasks.ya?ml"
11+
pull_request:
12+
paths:
13+
- ".github/workflows/check-taskfiles.ya?ml"
14+
- "**/Taskfile.ya?ml"
15+
- "**/DistTasks.ya?ml"
16+
schedule:
17+
# Run every Tuesday at 8 AM UTC to catch breakage resulting from changes to the JSON schema.
18+
- cron: "0 8 * * TUE"
19+
workflow_dispatch:
20+
repository_dispatch:
21+
22+
jobs:
23+
validate:
24+
name: Validate ${{ matrix.file }}
25+
runs-on: ubuntu-latest
26+
27+
strategy:
28+
fail-fast: false
29+
30+
matrix:
31+
file:
32+
# TODO: add paths to any additional Taskfiles here
33+
- ./**/Taskfile.yml
34+
- ./DistTasks.yml
35+
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v2
39+
40+
- name: Download JSON schema for Taskfiles
41+
id: download-schema
42+
uses: carlosperate/download-file-action@v1.0.3
43+
with:
44+
# See: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/taskfile.json
45+
file-url: https://json.schemastore.org/taskfile.json
46+
location: ${{ runner.temp }}/taskfile-schema
47+
48+
- name: Install JSON schema validator
49+
run: |
50+
sudo npm install \
51+
--global \
52+
ajv-cli \
53+
ajv-formats
54+
55+
- name: Validate ${{ matrix.file }}
56+
run: |
57+
# See: https://github.com/ajv-validator/ajv-cli#readme
58+
ajv validate \
59+
--all-errors \
60+
--strict=false \
61+
-c ajv-formats \
62+
-s "${{ steps.download-schema.outputs.file-path }}" \
63+
-d "${{ matrix.file }}"

0 commit comments

Comments
 (0)