diff --git a/noxfile.py b/noxfile.py index 9a35d81..9edfc43 100644 --- a/noxfile.py +++ b/noxfile.py @@ -4,6 +4,7 @@ # /// """Nox setup.""" +import os import shutil from pathlib import Path @@ -29,8 +30,11 @@ def lint(s: nox.Session, /) -> None: @session(uv_groups=["lint"], reuse_venv=True) def precommit(s: nox.Session, /) -> None: - """Run prek.""" - s.run("prek", "run", "--all-files", *s.posargs) + """Run the pre-commit hooks (via prek).""" + # Not a real commit -- no-commit-to-branch would always fail here. + # Merge into any SKIP already set, rather than clobber it. + skip = ",".join(filter(None, [os.environ.get("SKIP"), "no-commit-to-branch"])) + s.run("prek", "run", "--all-files", *s.posargs, env={"SKIP": skip}) @session(uv_groups=["lint"], reuse_venv=True)