Skip to content

Commit 5f0632e

Browse files
authored
Merge pull request #11 from per1234/validate-action_yml
Add CI workflow to validate action.yml against JSON schema
2 parents 4e4af45 + 8dd052f commit 5f0632e

File tree

2 files changed

+60
-3
lines changed

2 files changed

+60
-3
lines changed
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Validate action.yml
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- ".github/workflows/validate-action_yml.yml"
7+
- "action.yml"
8+
push:
9+
paths:
10+
- ".github/workflows/validate-action_yml.yml"
11+
- "action.yml"
12+
# Scheduled trigger to catch workflow failure resulting from changes to the JSON schema
13+
schedule:
14+
# run every Tuesday at 3 AM UTC
15+
- cron: "0 3 * * 2"
16+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch
17+
workflow_dispatch:
18+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch
19+
repository_dispatch:
20+
21+
jobs:
22+
validate:
23+
runs-on: ubuntu-latest
24+
25+
env:
26+
JSON_SCHEMA_FOLDER: etc/github-action-json-schema
27+
JSON_SCHEMA_FILENAME: github-action.json
28+
29+
steps:
30+
- name: Checkout local repository
31+
uses: actions/checkout@v2
32+
33+
# See: https://github.com/carlosperate/download-file-action/blob/master/README.md
34+
- name: Download JSON schema for action.yml
35+
uses: carlosperate/[email protected]
36+
with:
37+
# See: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-action.json
38+
file-url: https://json.schemastore.org/github-action
39+
location: ${{ env.JSON_SCHEMA_FOLDER }}
40+
file-name: ${{ env.JSON_SCHEMA_FILENAME }}
41+
42+
- name: Install JSON schema validator
43+
run: sudo npm install --global ajv-cli
44+
45+
# See: https://github.com/ajv-validator/ajv-cli/blob/master/README.md
46+
- name: Validate action.yml
47+
run: ajv -s "${{ env.JSON_SCHEMA_FOLDER }}/${{ env.JSON_SCHEMA_FILENAME }}" -d action.yml

action.yml

+13-3
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,43 @@ inputs:
44
cli-version:
55
description: 'Version of Arduino CLI to use when building'
66
default: 'latest'
7+
required: true
78
fqbn:
89
description: 'Full qualified board name, with Boards Manager URL if needed'
910
default: 'arduino:avr:uno'
11+
required: true
1012
libraries:
1113
description: 'YAML-format list of library dependencies to install'
1214
default: '- source-path: ./'
15+
required: true
1316
platforms:
1417
description: 'YAML-format list of platform dependencies to install'
1518
default: ''
19+
required: true
1620
sketch-paths:
1721
description: 'YAML-format list of paths containing sketches to compile.'
1822
default: '- examples'
23+
required: true
1924
verbose:
2025
description: 'Set to true to show verbose output in the log'
21-
default: false
26+
default: 'false'
27+
required: true
2228
sketches-report-path:
2329
description: 'Path in which to save a JSON formatted file containing data from the sketch compilations'
2430
default: 'sketches-reports'
31+
required: true
2532
github-token:
2633
description: 'GitHub access token used to get information from the GitHub API. Only needed if you are using the deltas report feature in a private repository.'
2734
default: ''
35+
required: true
2836
enable-deltas-report:
2937
description: 'Set to true to cause the action to determine the change in memory usage and compiler warnings of the compiled sketches between the head and base refs of a PR and the immediate parent commit of a push'
30-
default: false
38+
default: 'false'
39+
required: true
3140
enable-warnings-report:
3241
description: 'Set to true to cause the action to record the compiler warning count for each sketch compilation in the sketches report'
33-
default: false
42+
default: 'false'
43+
required: true
3444

3545
runs:
3646
using: 'docker'

0 commit comments

Comments
 (0)