Skip to content

Commit c207eb4

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 c207eb4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

sections/advanced.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,3 +885,8 @@ tag or SHA) and will cache based on that. Using a branch name (or `HEAD`) for
885885
the value of [`rev`](#repos-rev) is not supported and will only represent the state of
886886
that mutable ref at the time of hook installation (and will *NOT* update
887887
automatically).
888+
889+
## Detecting when `pre-commit` is running
890+
891+
You can check for the existence of the `PRE_COMMIT` environment variable within
892+
a hook to determine if it's being run from `pre-commit`.

0 commit comments

Comments
 (0)