GitHub Actions workflow that validates JSON files in /prepr/schema against the Prepr schema spec.
- Validate schema changes early in pull requests and before merges.
- Enforce consistent schema quality with one workflow across repositories.
- Get file-level error output that is easy to review and fix.
- Prevent invalid schema updates from reaching
main.
Create .github/workflows/prepr-schema-validation.yml in your repository:
name: Validate Prepr schema
on:
workflow_dispatch:
pull_request:
paths:
- 'prepr/schema/*.json'
push:
branches:
- main
paths:
- 'prepr/schema/*.json'
jobs:
validate-prepr-schema:
uses: preprio/action-schema-validation/.github/workflows/prepr-schema-validation.yml@v1- Every JSON file under
/prepr/schemais validated. - Validation errors are listed per file.
- Any validation error fails the job.
- Missing
/prepr/schemafails the job. - Empty
/prepr/schema(no.jsonfiles) fails the job. - GraphQL typenames must be unique across
Model,Enum,RemoteSource, andComponentfiles:Model:body_singular,body_pluralEnum:body_singularRemoteSource:body_singularComponent:api_id
This workflow exposes outputs for downstream jobs:
validation_result(successorfailure)files_checkedinvalid_filesreport_json(JSON string with file-level errors)
Example forwarding to Slack (or any notifier):
name: Validate and notify
on:
pull_request:
paths:
- 'prepr/schema/*.json'
jobs:
validate:
uses: preprio/action-schema-validation/.github/workflows/prepr-schema-validation.yml@v1
notify:
runs-on: ubuntu-latest
needs: validate
if: always()
steps:
- name: Print report
run: |
echo "result=${{ needs.validate.outputs.validation_result }}"
echo "files=${{ needs.validate.outputs.files_checked }}"
echo "invalid=${{ needs.validate.outputs.invalid_files }}"
echo '${{ needs.validate.outputs.report_json }}'Questions or issues: use GitHub Issues
Use a version tag when referencing the workflow (@v1, @v1.x.y), not a branch name.