From 1c585fde4e1157228202db652a85f408149a0e46 Mon Sep 17 00:00:00 2001 From: Andrew Pollock Date: Wed, 28 Aug 2024 11:04:09 +1000 Subject: [PATCH] ci(workflow): add a GitHub Action to validate JSON schema changes (#258) This will address the deficiency surfaced in #163 --------- Signed-off-by: Andrew Pollock --- .github/workflows/validate-schema.yml | 35 +++++++++++++++++++++++++++ .gitignore | 2 ++ 2 files changed, 37 insertions(+) create mode 100644 .github/workflows/validate-schema.yml create mode 100644 .gitignore diff --git a/.github/workflows/validate-schema.yml b/.github/workflows/validate-schema.yml new file mode 100644 index 00000000..7e4cab10 --- /dev/null +++ b/.github/workflows/validate-schema.yml @@ -0,0 +1,35 @@ +name: Validate OSV JSON Schema + +on: + pull_request: + branches: + - main + types: + - opened + - edited + - reopened + +permissions: + pull-requests: read + +jobs: + validate-osv-schema: + name: Validate OSV Schema + permissions: + contents: read + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Check for changes to OSV Schema + id: check-for-changed-osv-schema + uses: tj-actions/changed-files@v41 + with: + files: | + validation/schema.json + - name: Validate OSV Schema + if: steps.check-for-changed-osv-schema.outputs.any_changed == 'true' + uses: dsanders11/json-schema-validate-action@v1.1.2 + with: + # https://github.com/marketplace/actions/json-schema-validate#validating-schema + schema: json-schema + files: validation/schema.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..42e9f7c3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +go.work +go.work.sum