Skip to content

Commit

Permalink
Add schema validation for the various files in .github
Browse files Browse the repository at this point in the history
This won't catch all errors, as the schema validation can't actually
validate expressions in GitHub Actions (in both workflows and
actions).

However, this should cut out many of the badness we (I) have managed
to land and only noticed when the workflow first runs.
  • Loading branch information
gsnedders committed Oct 18, 2024
1 parent 7e91324 commit 8077838
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/github-schema-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: '.github schema check'

on:
workflow_dispatch:
push:
branches:
- master
paths:
- '.github/dependabot.yml'
- '.github/actions/*/action.yml'
- '.github/workflows/*.yml'
pull_request:
paths:
- '.github/dependabot.yml'
- '.github/actions/*/action.yml'
- '.github/workflows/*.yml'

jobs:
github-schemas:
runs-on: ubuntu-24.04
steps:
- name: '.github/dependabot.yml'
if: ${{ hashFiles('.github/dependabot.yml') != '' }}
uses: cardinalby/schema-validator-action@v3
with:
file: '.github/dependabot.yml'
schema: 'https://json.schemastore.org/dependabot-2.0.json'

- name: '.github/actions'
if: ${{ hashFiles('.github/actions/*/action.yml') != '' }}
uses: cardinalby/schema-validator-action@v3
with:
file: '.github/actions/*/action.yml'
schema: 'https://json.schemastore.org/github-action.json'

- name: '.github/workflows'
if: ${{ hashFiles('.github/workflows/*.yml') != '' }}
uses: cardinalby/schema-validator-action@v3
with:
file: '.github/workflows/*.yml'
schema: 'https://json.schemastore.org/github-workflow.json'

0 comments on commit 8077838

Please sign in to comment.