Open pschirch opened 5 days ago
Hey @pschirch ! Does it work when you're running Git hooks? Is it important for you to have this rc
file working for non-git hooks? Originally rc
option was supposed to be used when you are using git in a IDE or your shell doesn't provide some environment variables required for your hooks.
:wrench: Summary
We use an environment variable based tool stack. So it should be possible to skip specific lefthook commands by configure an environment variable, e.q.
SOME_CHECK_ENABLED
. We read aboutrc:
in docs and found our use case:Furthermore, based on the consumption that
rc:
exports all environment variables from an.env
file, it should be possible to useskip
from docs to skip a command like:I hope my explanations are sufficient. I am grateful for any advice.
Lefthook version
1.8.4
Steps to reproduce
.env
lefthook.rc
We also test
and
lefthook.yaml
Expected results
The environment variable
SOME_CHECK_ENABLED
processed in rc filelefthook.rc
should be available in command'ssome:check
skip run
to made the skip test.Furthermore, the command's
some:check
run
should also aware of these environment variables.Change command
some:check
run torun: env
for a test.Actual results
The environment variable
SOME_CHECK_ENABLED
is not available, theskip
test fails and the commandsome:check
will be executed.Possible Solution
Less a solution, more a workaround.
Source
. "$(cd "$(dirname "$0")" && pwd)/.env"
inskip run
every time.Logs / Screenshots