Skip to content

Commit 31a047f

Browse files
Merge pull request #42 from MatteoPologruto/check-taskfiles
Add CI workflow to validate Taskfiles
2 parents 9ede82c + 812e15e commit 31a047f

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

.github/workflows/check-taskfiles.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-taskfiles.md
2+
name: Check Taskfiles
3+
4+
env:
5+
# See: https://github.com/actions/setup-node/#readme
6+
NODE_VERSION: 12.x
7+
8+
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
9+
on:
10+
push:
11+
paths:
12+
- ".github/workflows/check-taskfiles.ya?ml"
13+
- "package.json"
14+
- "package-lock.json"
15+
- "**/Taskfile.ya?ml"
16+
pull_request:
17+
paths:
18+
- ".github/workflows/check-taskfiles.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+
name: Validate ${{ matrix.file }}
31+
runs-on: ubuntu-latest
32+
33+
strategy:
34+
fail-fast: false
35+
36+
matrix:
37+
file:
38+
- ./**/Taskfile.yml
39+
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@v3
43+
44+
- name: Setup Node.js
45+
uses: actions/setup-node@v3
46+
with:
47+
node-version: ${{ env.NODE_VERSION }}
48+
49+
- name: Download JSON schema for Taskfiles
50+
id: download-schema
51+
uses: carlosperate/download-file-action@v1
52+
with:
53+
# See: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/taskfile.json
54+
file-url: https://json.schemastore.org/taskfile.json
55+
location: ${{ runner.temp }}/taskfile-schema
56+
57+
- name: Install JSON schema validator
58+
run: npm install
59+
60+
- name: Validate ${{ matrix.file }}
61+
run: |
62+
# See: https://github.com/ajv-validator/ajv-cli#readme
63+
npx \
64+
--package=ajv-cli \
65+
--package=ajv-formats \
66+
ajv validate \
67+
--all-errors \
68+
--strict=false \
69+
-c ajv-formats \
70+
-s "${{ steps.download-schema.outputs.file-path }}" \
71+
-d "${{ matrix.file }}"

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[![Sync Labels status](https://github.com/arduino/setup-protoc/actions/workflows/sync-labels-npm.yml/badge.svg)](https://github.com/arduino/setup-protoc/actions/workflows/sync-labels-npm.yml)
66
[![Check Markdown status](https://github.com/arduino/setup-protoc/actions/workflows/check-markdown-task.yml/badge.svg)](https://github.com/arduino/setup-protoc/actions/workflows/check-markdown-task.yml)
77
[![Check License status](https://github.com/arduino/setup-protoc/actions/workflows/check-license.yml/badge.svg)](https://github.com/arduino/setup-protoc/actions/workflows/check-license.yml)
8+
[![Check Taskfiles status](https://github.com/arduino/setup-protoc/actions/workflows/check-taskfiles.yml/badge.svg)](https://github.com/arduino/setup-protoc/actions/workflows/check-taskfiles.yml)
89

910
This action makes the `protoc` compiler available to Workflows.
1011

0 commit comments

Comments
 (0)