GitHub Action Validate Frontmatter - SSWConsulting/SSW.Rules.Content GitHub Wiki
This GitHub Action validates the YAML frontmatter in markdown (.md) files whenever a pull request is opened or updated. It checks for required fields, formatting issues, and schema violations to ensure content consistency across rules and categories.
When It Runs
-
On pull requests to
main -
Manually, via the "Run workflow" button in the Actions tab
What It Does
1. Checks out the PR branch
-
Pulls the full Git history (
fetch-depth: 0) -
Uses the PR branch as the ref to analyze changes
2. Sets up Node.js
- Required for running the validation script
3. Gets changed files
-
Uses
git diffagainstorigin/mainto collect the list of changed files -
Stores the list as a comma-separated string (
env.changed)
4. Runs the frontmatter validator script
5. Adds a summary (if validation fails)
- Displays errors in the GitHub Actions summary view so contributors can easily review what's wrong
6. Leaves a comment on the PR (if from same repo)
- If the validation fails and the PR is not from a fork, it will comment directly on the pull request with a list of the issues.