Skip to content

feat: introduce setup hook option - #1326

Merged
mrexox merged 7 commits into
evilmartians:masterfrom
mrexox:feat/introduce-setup-hook-option
Mar 1, 2026
Merged

feat: introduce setup hook option#1326
mrexox merged 7 commits into
evilmartians:masterfrom
mrexox:feat/introduce-setup-hook-option

Conversation

@mrexox

@mrexox mrexox commented Feb 28, 2026

Copy link
Copy Markdown
Member

Closes #1218

Context

Sometimes special "pre-run" actions are required for hook jobs to be run correctly. Moving it to a first job may be a good solution, but such approach is quite limited.

So, setup option is here to fill the gap.

# lefthook.yml

pre-commit:
  setup:
    - run: mise install
  jobs:
    - run: bundle exec ...
    - run: node scripts/some-script.js
    - run: cargo ...

setup option has good potential for more things that include preparing the environment for pre-commit jobs. setup instructions must be idempotent to make conditions repeatable and stable.

Changes

  • Add setup option to config
  • When merging setup always prepend new instructions (the opposite to extend logic)
  • Execute setup instructions before running all jobs
    • Support templates replacement
    • Log separately
    • Add a separate output log control
  • Add tests
  • Add docs

@mrexox
mrexox force-pushed the feat/introduce-setup-hook-option branch 2 times, most recently from 2e3929d to 4604ec3 Compare February 28, 2026 20:28
@mrexox
mrexox force-pushed the feat/introduce-setup-hook-option branch from 4604ec3 to bcaffc3 Compare February 28, 2026 20:36
@mrexox
mrexox marked this pull request as ready for review March 1, 2026 20:15
@mrexox
mrexox merged commit 6fb8e50 into evilmartians:master Mar 1, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Job order is reversed when using extends in remote configs

1 participant