Skip to content

Commit

Permalink
Add pre-commit hook to check for uncommitted regenerated spec files.
Browse files Browse the repository at this point in the history
Skip hook when calling pre-commit in generate script to avoid recursion.
  • Loading branch information
rtibbles committed Jan 12, 2024
1 parent 027970b commit 0bd48e5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
exclude: (\.git/|\.tox/|\.venv/|le_utils\.egg-info)
repos:
- repo: local
hooks:
- id: rebuild-from-specs
name: Regenerate files
description: Regenerates files when specs or version has changed
entry: make build
language: system
files: (spec/.*\.json|setup\.py)$
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.0.0
hooks:
Expand Down
5 changes: 4 additions & 1 deletion scripts/generate_from_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,7 @@ def set_package_json_version():

output_files += set_package_json_version()

subprocess.call(["pre-commit", "run", "--files"] + output_files)
env = os.environ.copy()
env["SKIP"] = "rebuild-from-specs"

subprocess.call(["pre-commit", "run", "--files"] + output_files, env=env)

0 comments on commit 0bd48e5

Please sign in to comment.