Skip to content

Check Configuration Files #232

Check Configuration Files

Check Configuration Files #232

Workflow file for this run

name: Check Configuration Files
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
push:
paths:
- ".github/workflows/check-configs.yml"
- "**/.eslintrc.yml"
- "**/.markdownlint.yml"
- "**/dependabot.yml"
- "workflow-templates/assets/sync-labels/arduino-gh-label-configuration-schema.json"
- "workflow-templates/assets/sync-labels/*.yml"
pull_request:
paths:
- ".github/workflows/check-configs.yml"
- "**/.eslintrc.yml"
- "**/.markdownlint.yml"
- "**/dependabot.yml"
- "workflow-templates/assets/sync-labels/arduino-gh-label-configuration-schema.json"
- "workflow-templates/assets/sync-labels/*.yml"
schedule:
# Run every Tuesday at 8 AM UTC to catch breakage resulting from changes to the JSON schema.
- cron: "0 8 * * TUE"
workflow_dispatch:
repository_dispatch:
jobs:
validate:
name: ${{ matrix.configuration.path }}
runs-on: ubuntu-latest
permissions: {}
env:
# .eslintrc, .prettierrc, and dependabot.yml schemas are draft-04, which is unsupported by avj-cli 4.x
AJV_CLI_VERSION: 3.3.0
strategy:
fail-fast: false
matrix:
configuration:
- path: "**/.eslintrc.yml"
# See: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/eslintrc.json
schema-url: https://json.schemastore.org/eslintrc
- path: "**/.prettierrc.yml"
# See: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/prettierrc.json
schema-url: https://json.schemastore.org/prettierrc
- path: "**/dependabot.yml"
# See: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/dependabot-2.0.json
schema-url: https://json.schemastore.org/dependabot-2.0
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download JSON schema
id: download-schema
if: matrix.configuration.schema-url != ''
uses: carlosperate/download-file-action@v2
with:
file-url: ${{ matrix.configuration.schema-url }}
location: ${{ runner.temp }}
file-name: schema.json
- name: Install JSON schema validator
run: sudo npm install --global ajv-cli@${{ env.AJV_CLI_VERSION }}
- name: Validate configuration files
run: |
# See: https://github.com/ajv-validator/ajv-cli#readme
ajv validate \
-s "${{ steps.download-schema.outputs.file-path }}${{ matrix.configuration.schema-path }}" \
-d "${{ matrix.configuration.path }}"