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
Lefthook on windows can run powershell/pwsh as a runner #428
Comments
Hey! Thank you for the issue. Could you show your |
Yeah, I included it above, But here it is (in it's entirety;I did remove the default content) # 'pwsh.exe -NoProfile -ExecutionPolicy Bypass -File ".\convcoGitHook.ps1 -MessagePath '$1'"'
commit-msg:
conventional-commits-check:
scripts:
"convcoGitHook.ps1":
runner: pwsh.exe -NoProfile -ExecutionPolicy Bypass -File I get the same result if I use the above runner or one of the following: runner: pwsh.exe
#OR
runner: pwsh
|
Hey! I guess you've misconfigured # 'pwsh.exe -NoProfile -ExecutionPolicy Bypass -File ".\convcoGitHook.ps1 -MessagePath '$1'"'
commit-msg:
scripts:
"convcoGitHook.ps1":
runner: pwsh.exe -NoProfile -ExecutionPolicy Bypass -File There is |
Ok, Made the change to lefthook.yml # 'pwsh.exe -NoProfile -ExecutionPolicy Bypass -File ".\convcoGitHook.ps1 -MessagePath '$1'"'
commit-msg:
scripts:
"convcoGitHook.ps1":
runner: pwsh.exe -NoProfile -ExecutionPolicy Bypass -File Results: No change
|
Sorry for the delay. Could you share a github repository with the example configuration? I mean |
Hey @mrexox, I apologize for the delayed response as work got in the way of responding... I've created a test repo to do further testing as requested: https://github.com/j-byrnes/testLefthook Since I see you've had several releases since my original post, I wasn't sure if the procedure for working on Windows had been updated. Please let me know what the next steps are for troubleshooting. |
Hey @j-byrnes! Thank you for the test repo. I just noticed that the Could you please move the |
Thanks for the catch, it looks a little better... now the output is the following > lefthook run commit-msg
Lefthook v1.3.9
RUNNING HOOK: commit-msg
testScript.ps1: (skip) not specified in config file
SUMMARY: (SKIP EMPTY) I've commited the changes to the repo... not sure what it is referring to that the file isn't specified in the config file. |
Oh, I see. The problem is - script name is converted to the lowercase when YAML is parsed. That's the problem I guess 😕 As a workaround I can suggest making script name in all lower case letters with |
That worked, I'm going to explore testing a little more, that may be it. Also, one more question: Do you have any suggestions for the "rc" configuration, does it have to be shell and can it use relative path names? |
The need is to leverage rc to set an environment variable to add lefthook path during execution. |
You can specify this: # lefthook.yml
rc: ./testrc.sh
# ... But this is not tested enough, however it should work (note |
🔧 Summary
When attempting to run Lefthook on Windows, it doesn't seem to identify/see the config file.
Lefthook version
1.2.9 0e6aa81
Steps to reproduce
Install
Prepare Repo
Files
Expected results
Actual results
Possible Solution
It is as if the config file isn't getting picked up/read/processed. The file
lefthoook.yml
is located in the root of the repoc:\repo
which was the location it was created duringinstall.
-v
argument doesn't seem to include any additional output,Per usage and configuration, I haven't been able to validate all the configuration file names/locations it would check.
While I'm not a Go programmer, I'm happy to do the heavy lifting on any/all testing for Windows since I know it's not the main focus.
Screenshots (if appropriate)
The text was updated successfully, but these errors were encountered: