Skip to content

Commit 1426752

Browse files
authored
Merge pull request #6 from per1234/check-configs
Add CI workflow to validate configuration files against JSON schema
2 parents 602565f + a9e0475 commit 1426752

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

.github/workflows/check-configs.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Check Configuration Files
2+
3+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
4+
on:
5+
push:
6+
paths:
7+
- ".github/workflows/check-configs.yml"
8+
- "Taskfile.ya?ml"
9+
- "**/dependabot.ya?ml"
10+
pull_request:
11+
paths:
12+
- ".github/workflows/check-configs.yml"
13+
- "Taskfile.ya?ml"
14+
- "**/dependabot.ya?ml"
15+
schedule:
16+
# Run every Tuesday at 8 AM UTC to catch breakage resulting from changes to the JSON schema.
17+
- cron: "0 8 * * TUE"
18+
workflow_dispatch:
19+
repository_dispatch:
20+
21+
jobs:
22+
validate:
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v2
28+
29+
- name: Install Task
30+
uses: arduino/setup-task@v1
31+
with:
32+
repo-token: ${{ secrets.GITHUB_TOKEN }}
33+
version: 3.x
34+
35+
- name: Validate configuration files
36+
run: task config:validate

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Tooling Project Assets
22

3+
[![Check Configuration Files status](https://github.com/arduino/tooling-project-assets/actions/workflows/check-configuration-files.yml/badge.svg)](https://github.com/arduino/tooling-project-assets/actions/workflows/check-configuration-files.yml)
34
[![Check License status](https://github.com/arduino/tooling-project-assets/actions/workflows/check-license.yml/badge.svg)](https://github.com/arduino/tooling-project-assets/actions/workflows/check-license.yml)
45
[![Check File Duplicates Sync status](https://github.com/arduino/tooling-project-assets/actions/workflows/check-sync.yml/badge.svg)](https://github.com/arduino/tooling-project-assets/actions/workflows/check-sync.yml)
56

Taskfile.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: "3"
2+
3+
tasks:
4+
check:
5+
desc: Check for problems with the project
6+
deps:
7+
- task: config:validate
8+
9+
config:validate:
10+
desc: Validate configuration files against their JSON schema
11+
vars:
12+
# Last version with support for draft-04, used by Dependabot schema
13+
AJV_CLI_VERSION: 3.3.0
14+
# Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/dependabot-2.0.json
15+
DEPENDABOT_SCHEMA_URL: https://json.schemastore.org/dependabot-2.0
16+
DEPENDABOT_SCHEMA_PATH:
17+
sh: mktemp -t dependabot-schema-XXXXXXXXXX.json
18+
DEPENDABOT_DATA_PATH: "**/dependabot.yml"
19+
cmds:
20+
- wget --quiet --output-document="{{.DEPENDABOT_SCHEMA_PATH}}" {{.DEPENDABOT_SCHEMA_URL}}
21+
- npx ajv-cli@{{.AJV_CLI_VERSION}} validate -s "{{.DEPENDABOT_SCHEMA_PATH}}" -d "{{.DEPENDABOT_DATA_PATH}}"

0 commit comments

Comments
 (0)