-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Needs a .git folder to be present, fails if missing even if $CI is true #563
Comments
Hey! Lefthook shouldn't be installed automatically in the CI. I assume that your postinstall script calls I would also recomment to use I don't think lefthook should support executing |
I don't need to run lefthook anywhere but locally when I clone the repo. A solution that allows me to disable running |
Sounds good, I think you can use a custom shell script with the following check: [ -z $CI ] && lefthook install || true Unfortunately, I don't know well how pnpm works but if the shell script doesn't work there's probably a way to write a custom JS script for that. The only problem is to correctly find the executable. |
I also encountered the same problem. The environment is as follows:
Indeed, there is a process to skip the installation in the CI environment. However, this process does not work if you explicitly install it using Do you think adding a CI environment check to the following code would be a solution? |
Hey @Maeda-Naoki! Could please tell more about the reasons you explicitly run |
I don't think this is a good idea because in this case the whole program behavior depends on environment variable. I believe that when someone uses But I am curios about how you use lefthook in the CI and I'd like to help with issues you met. |
Hi @mrexox .
I am using lefthook in the following environment.
I added the following script to package.json to initialize lefthook at git clone. "scripts": {
"prepare": "lefthook install",
}, If you don't do this, it will not show up as The problem is when you clone this repository in GitLab CI. |
@Maeda-Naoki , if you have lefthook listed in your |
🔧 Summary
Here's the context, but the gist is that I'm using
lefthook
in a repo that gets deployed on Vercel. When it builds, there's no .git folder present thanks to how Vercel works. Unfortunately, lefthook seems to need the .git folder, or theCI
flag isn't working right, since it's failing to build with lefthook installed in this setup.Lefthook version
1.5.1
Steps to reproduce
Try
pnpm install
without a .git folder present withCI=1
Expected results
A successful install
Actual results
A failure to build because of missing folder
Possible Solution
Don't require the .git folder
Logs / Screenshots
The text was updated successfully, but these errors were encountered: