Skip to content

Commit dd16416

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 dd16416

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
@@ -93,6 +93,9 @@ For example:
9393
types: [text]
9494
```
9595
96+
To determine if an application was spawned as a `pre-commit` hook you can check
97+
for the existence of the `PRE_COMMIT` environment variable.
98+
9699
## Developing hooks interactively
97100

98101
Since the [`repo`](#repos-repo) property of `.pre-commit-config.yaml` can refer to anything

0 commit comments

Comments
 (0)