Skip to content

Commit 16b6989

Browse files
committed
Add CI workflow to validate Taskfiles
On every push or pull request that affects the repository's Taskfiles, and periodically, validate them against the JSON schema.
1 parent 1994c62 commit 16b6989

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

.github/workflows/check-taskfiles.yml

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

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![Test Go status](https://github.com/arduino/libraries-repository-engine/actions/workflows/test-go.yml/badge.svg)](https://github.com/arduino/libraries-repository-engine/actions/workflows/test-go.yml)
44
[![Check Go status](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-go.yml/badge.svg)](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-go.yml)
55
[![Check Prettier Formatting status](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-prettier-formatting-task.yml/badge.svg)](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-prettier-formatting-task.yml)
6+
[![Check Taskfiles status](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-taskfiles.yml/badge.svg)](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-taskfiles.yml)
67
[![Spell Check status](https://github.com/arduino/libraries-repository-engine/actions/workflows/spell-check-task.yml/badge.svg)](https://github.com/arduino/libraries-repository-engine/actions/workflows/spell-check-task.yml)
78
[![Check License status](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-license.yml/badge.svg)](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-license.yml)
89

0 commit comments

Comments
 (0)