Skip to content

Commit 29dbcea

Browse files
committed
lint yaml files
1 parent b31ffe4 commit 29dbcea

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Validate Workflows
2+
3+
on:
4+
push:
5+
paths:
6+
- ".github/workflows/**/*.yml"
7+
- ".github/workflows/**/*.yaml"
8+
pull_request:
9+
paths:
10+
- ".github/workflows/**/*.yml"
11+
- ".github/workflows/**/*.yaml"
12+
13+
jobs:
14+
validate:
15+
name: Lint & Schema Validate Workflows
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
# Step 1: Run actionlint for logic/deprecation checks
23+
- name: Run actionlint
24+
uses: raven-actions/actionlint@v1
25+
26+
# Step 2: Set up Python for schema validation
27+
- name: Set up Python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: "3.x"
31+
32+
- name: Install check-jsonschema
33+
run: pip install check-jsonschema
34+
35+
# Step 3: Validate each workflow YAML file against schema
36+
- name: Validate against GitHub workflow schema
37+
run: |
38+
for file in $(find .github/workflows -name "*.y*ml"); do
39+
echo "Validating $file..."
40+
check-jsonschema \
41+
--schemafile https://json.schemastore.org/github-workflow.json \
42+
"$file"
43+
done

0 commit comments

Comments
 (0)