Skip to content

Commit

Permalink
feat: add make generate to pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
stehessel committed Nov 13, 2023
1 parent 9c36b02 commit f8e00f2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions scripts/run-make-generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/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

if ! [ -x "$(command -v jsonnet)" ]; then
go install github.com/google/go-jsonnet/cmd/jsonnet@latest
fi

if ! [ -x "$(command -v yq)" ]; then
go install github.com/mikefarah/yq/v4@latest
fi

SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" &>/dev/null && pwd 2>/dev/null)"

make -C "$SCRIPT_DIR"/.. generate

0 comments on commit f8e00f2

Please sign in to comment.