Skip to content

Add CI workflow to validate action.yml against JSON schema #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/validate-action_yml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Validate action.yml

on:
pull_request:
paths:
- ".github/workflows/validate-action_yml.yml"
- "action.yml"
push:
paths:
- ".github/workflows/validate-action_yml.yml"
- "action.yml"
# Scheduled trigger to catch workflow failure resulting from changes to the JSON schema
schedule:
# run every Tuesday at 3 AM UTC
- cron: "0 3 * * 2"
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch
workflow_dispatch:
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch
repository_dispatch:

jobs:
validate:
runs-on: ubuntu-latest

env:
JSON_SCHEMA_FOLDER: etc/github-action-json-schema
JSON_SCHEMA_FILENAME: github-action.json

steps:
- name: Checkout local repository
uses: actions/checkout@v2

# See: https://github.com/carlosperate/download-file-action/blob/master/README.md
- name: Download JSON schema for action.yml
uses: carlosperate/[email protected]
with:
# See: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-action.json
file-url: https://json.schemastore.org/github-action
location: ${{ env.JSON_SCHEMA_FOLDER }}
file-name: ${{ env.JSON_SCHEMA_FILENAME }}

- name: Install JSON schema validator
run: sudo npm install --global ajv-cli

# See: https://github.com/ajv-validator/ajv-cli/blob/master/README.md
- name: Validate action.yml
run: ajv -s "${{ env.JSON_SCHEMA_FOLDER }}/${{ env.JSON_SCHEMA_FILENAME }}" -d action.yml
16 changes: 13 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,43 @@ inputs:
cli-version:
description: 'Version of Arduino CLI to use when building'
default: 'latest'
required: true
fqbn:
description: 'Full qualified board name, with Boards Manager URL if needed'
default: 'arduino:avr:uno'
required: true
libraries:
description: 'YAML-format list of library dependencies to install'
default: '- source-path: ./'
required: true
platforms:
description: 'YAML-format list of platform dependencies to install'
default: ''
required: true
sketch-paths:
description: 'YAML-format list of paths containing sketches to compile.'
default: '- examples'
required: true
verbose:
description: 'Set to true to show verbose output in the log'
default: false
default: 'false'
required: true
sketches-report-path:
description: 'Path in which to save a JSON formatted file containing data from the sketch compilations'
default: 'sketches-reports'
required: true
github-token:
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.'
default: ''
required: true
enable-deltas-report:
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'
default: false
default: 'false'
required: true
enable-warnings-report:
description: 'Set to true to cause the action to record the compiler warning count for each sketch compilation in the sketches report'
default: false
default: 'false'
required: true

runs:
using: 'docker'
Expand Down