Skip to content

XS⚠️ ◾ Validating all frontmatter for issues #42

XS⚠️ ◾ Validating all frontmatter for issues

XS⚠️ ◾ Validating all frontmatter for issues #42

name: Validate-Frontmatter-in-All-Rules
on:
push:
branches: [main]
paths:
- 'rules/**/*.md'
pull_request:
branches: [main]
workflow_dispatch:
jobs:
validate-all-frontmatter:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v3
- name: Find all Markdown files in rules
run: |
find rules -type f -name '*.md' > all_rules_files.txt
echo "Found Markdown files:"
cat all_rules_files.txt
- name: Install dependencies
run: |
cd scripts/frontmatter-validator
npm install
- name: Validate Frontmatter in Rule Files
id: validate_frontmatter
run: |
echo "results<<EOF" >> $GITHUB_ENV
node scripts/frontmatter-validator/frontmatter-validator.js --file all_rules_files.txt
echo "EOF" >> $GITHUB_ENV
- name: Create Job Summary with errors
if: failure()
run: |
echo "## Frontmatter Validation Issues" >> $GITHUB_STEP_SUMMARY
echo "${{ env.results }}" >> $GITHUB_STEP_SUMMARY
- name: Create Job Summary with no errors
if: success()
run: |
echo "## Frontmatter Validation Issues" >> $GITHUB_STEP_SUMMARY
echo "No validation issues file found or no issues detected." >> $GITHUB_STEP_SUMMARY