Skip to content

Commit 6e7d5d6

Browse files
authored
Merge pull request #58 from lightspeedwp/claude/move-frontmatter-schema-folder-011CV3i3p2ybWHtcbzRPXmat
Move frontmatter schema to subfolder
2 parents 12441a4 + e4c2f6d commit 6e7d5d6

File tree

10 files changed

+1579
-0
lines changed

10 files changed

+1579
-0
lines changed

.github/workflows/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Workflow artifacts and logs
2+
validation-errors.log
3+
*.log
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
---
2+
name: Frontmatter Validation
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
- develop
9+
- 'claude/**'
10+
paths:
11+
- '**.md'
12+
- 'schemas/frontmatter/**'
13+
- '.github/workflows/frontmatter-validation.yml'
14+
pull_request:
15+
paths:
16+
- '**.md'
17+
- 'schemas/frontmatter/**'
18+
- '.github/workflows/frontmatter-validation.yml'
19+
workflow_dispatch:
20+
21+
jobs:
22+
validate-schema:
23+
name: Validate Frontmatter Schema
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
30+
- name: Setup Node.js
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: '20'
34+
cache: 'npm'
35+
cache-dependency-path: schemas/frontmatter/package-lock.json
36+
37+
- name: Install dependencies
38+
working-directory: schemas/frontmatter
39+
run: npm ci
40+
41+
- name: Validate schema structure
42+
working-directory: schemas/frontmatter
43+
run: npm run validate:schema
44+
45+
- name: Run schema tests
46+
working-directory: schemas/frontmatter
47+
run: npm test
48+
49+
validate-frontmatter:
50+
name: Validate All Frontmatter
51+
runs-on: ubuntu-latest
52+
needs: validate-schema
53+
54+
steps:
55+
- name: Checkout repository
56+
uses: actions/checkout@v4
57+
58+
- name: Setup Node.js
59+
uses: actions/setup-node@v4
60+
with:
61+
node-version: '20'
62+
cache: 'npm'
63+
cache-dependency-path: schemas/frontmatter/package-lock.json
64+
65+
- name: Install dependencies
66+
working-directory: schemas/frontmatter
67+
run: npm ci
68+
69+
- name: Validate all frontmatter files
70+
working-directory: schemas/frontmatter
71+
run: npm run validate
72+
73+
- name: Upload validation report
74+
if: failure()
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: validation-errors
78+
path: schemas/frontmatter/validation-errors.log
79+
retention-days: 7
80+
81+
frontmatter-changed-files:
82+
name: Validate Changed Files Only
83+
runs-on: ubuntu-latest
84+
if: github.event_name == 'pull_request'
85+
86+
steps:
87+
- name: Checkout repository
88+
uses: actions/checkout@v4
89+
with:
90+
fetch-depth: 0
91+
92+
- name: Setup Node.js
93+
uses: actions/setup-node@v4
94+
with:
95+
node-version: '20'
96+
cache: 'npm'
97+
cache-dependency-path: schemas/frontmatter/package-lock.json
98+
99+
- name: Install dependencies
100+
working-directory: schemas/frontmatter
101+
run: npm ci
102+
103+
- name: Get changed markdown files
104+
id: changed-files
105+
uses: tj-actions/changed-files@v44
106+
with:
107+
files: |
108+
**.md
109+
110+
- name: Validate changed files
111+
if: steps.changed-files.outputs.any_changed == 'true'
112+
working-directory: schemas/frontmatter
113+
run: |
114+
echo "Validating changed files:"
115+
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
116+
echo " - $file"
117+
node validate.js "../../$file" || exit 1
118+
done
119+
120+
- name: Comment on PR
121+
if: failure() && github.event_name == 'pull_request'
122+
uses: actions/github-script@v7
123+
with:
124+
script: |
125+
github.rest.issues.createComment({
126+
issue_number: context.issue.number,
127+
owner: context.repo.owner,
128+
repo: context.repo.repo,
129+
body: '⚠️ **Frontmatter validation failed**\n\nPlease check the workflow logs for details and ensure all frontmatter follows the schema at `schemas/frontmatter/frontmatter.schema.json`.\n\nSee [Frontmatter Documentation](https://github.com/lightspeedwp/.github/blob/develop/schemas/frontmatter/README.md) for guidance.'
130+
})

0 commit comments

Comments
 (0)