-
Notifications
You must be signed in to change notification settings - Fork 4
45 lines (39 loc) · 1.4 KB
/
check-workflows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Check Workflows
# See: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows
on:
push:
paths:
- ".github/workflows/*.yaml"
- ".github/workflows/*.yml"
pull_request:
paths:
- ".github/workflows/*.yaml"
- ".github/workflows/*.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:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download JSON schema for GitHub Actions workflows
id: download-schema
uses: carlosperate/download-file-action@v2
with:
# See: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-workflow.json
file-url: https://json.schemastore.org/github-workflow
location: ${{ runner.temp }}/github-workflow-schema
file-name: github-workflow.json
- name: Install JSON schema validator
run: sudo npm install --global ajv-cli
- name: Validate GitHub Actions workflows
run: |
# See: https://github.com/ajv-validator/ajv-cli#readme
ajv validate \
--strict=false \
-s "${{ steps.download-schema.outputs.file-path }}" \
-d "./.github/workflows/*.{yml,yaml}"