Skip to content

Commit ed0a26d

Browse files
Document PRE_COMMIT environment variable
Document this variable, exposed since `v2.5.0`[1], as a way to determine if `pre-commit` is running. Because It took a bit of searching in the `pre-commit` repo to discover the existence of this variable. Link: pre-commit/pre-commit@2f25085 [1]
1 parent cbfaac7 commit ed0a26d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sections/new-hooks.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ installable package (gem, npm, pypi, etc.) or exposes an executable, it can be
44
used with pre-commit. Each git repo can support as many languages/hooks as you
55
want.
66

7+
_New in 2.5.0_: `pre-commit` sets the `PRE_COMMIT=1` environment variable
8+
during hook execution.
9+
710
The hook must exit nonzero on failure or modify files.
811

912
A git repo containing pre-commit plugins must contain a `.pre-commit-hooks.yaml`

0 commit comments

Comments
 (0)