diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7ae39f4e53..86b7f6bef5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,11 +39,20 @@ repos: language: script pass_filenames: false description: "Runs `golangci-lint`, requires https://github.com/golangci/golangci-lint" + - repo: local + hooks: + - id: generate-zarf-schema + name: Check for outdated Zarf schema + entry: hooks/verify-zarf-schema.sh + files: "cli/types/types.go" + types: [go] + language: script + description: "Runs `zarf tools config-schema > zarf.schema.json` to ensure schema is up to date" - repo: https://github.com/python-jsonschema/check-jsonschema rev: 0.14.0 hooks: - id: check-jsonschema - name: "Validate Zarf Schema" + name: "Validate Zarf Configs Against Schema" files: "zarf.yaml" types: [yaml] args: ["--schemafile", "zarf.schema.json"] diff --git a/hooks/verify-zarf-schema.sh b/hooks/verify-zarf-schema.sh new file mode 100755 index 0000000000..cc45b23078 --- /dev/null +++ b/hooks/verify-zarf-schema.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +go run cli/main.go tools config-schema > zarf.schema.json