Skip to content
Merged
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
- uses: j178/prek-action@v3.0.0
with:
extra-args: --all-files
env:
# Not a real commit -- no-commit-to-branch would always fail here.
SKIP: no-commit-to-branch

# Where there's smoke, there's fire!
smoke:
Expand Down
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ repos:
- id: no-commit-to-branch
args: ["--branch", "main", "--pattern", "^versions/.*"]
always_run: true
# Restrict to pre-commit so a push (e.g. a release tag) isn't mistaken for a commit.
stages: [pre-commit]
- id: trailing-whitespace

- repo: https://github.com/pre-commit/pygrep-hooks
Expand Down
4 changes: 4 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ def _xdist_args(posargs: list[str]) -> list[str]:
def lint(session: nox.Session) -> None:
"""Run the linter."""
session.install("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"]))
session.run(
"prek",
"run",
"--all-files",
"--show-diff-on-failure",
*session.posargs,
env={"SKIP": skip},
)


Expand Down