diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 17029307..73a15da0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,6 +12,11 @@ repos: - id: end-of-file-fixer - repo: local hooks: + - id: make-generate + name: make generate + entry: ./scripts/run-make-generate.sh + language: system + pass_filenames: false - id: grafana-lint name: grafana lint entry: ./scripts/lint-grafana.sh diff --git a/scripts/run-make-generate.sh b/scripts/run-make-generate.sh new file mode 100755 index 00000000..98ebed91 --- /dev/null +++ b/scripts/run-make-generate.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -eu + +if ! [ -x "$(command -v jb)" ]; then + go install -a github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest +fi + +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" &>/dev/null && pwd 2>/dev/null)" + +make -C "$SCRIPT_DIR"/.. generate