Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Support configuring run-time environment options generically #1157
Comments
|
you can do that with |
|
Thank you for the pointer! I guess overriding the entrypoint should work out in our case, even though it increases the coupling between configuration and hook. It’s a bit problematic that the entrypoint is not passed through a shell. Going via |
well for a couple reasons:
you'd have the same level of quoting either way as you have to make a shell command. yaml supports bare words so you probably don't need anything tricky here anyway
thanks for the suggestion, but no (as per above) pre-commit has a golden path which is where pre-commit manages all the environments and dependencies. when you start to step outside that you're going to need to do tricky things -- pre-commit is not going to support those directly because it steps outside the bounds of the happy path (requiring extra setup on the user's side, etc.) |


It would be useful if we could configure certain aspects of the run-time environment from which hooks are run. E.g., I would find it awesome if I could:
My immediate use-case is to work-around ansible/ansible-lint#245, which would require both custom environment variables as well as switching the working directory. However, I expect that this would be great to have for other situations, as well.
E.g., while pre-commit does a great job of isolating a hooks environment by installing all dependencies of a Python-hosted hooks in an isolated location, a lot of my co-workers are using outdated distributions resp. Python installations. To keep our workflow as uniform as possible, I take steps which will create repository-local installations of Python, Node.js and other run-times. For working on the command-line, I usually rely on direnv to install any run-times and to adjust the user’s
PATHso that repository-local installations are used. It would be great if I could configure pre-commit so that, prior to running any hook, pre-commit would source a script of my choosing.Thank you for making pre-commit!