Skip to content

Support the root option at the group level #1469

Description

@paduszyk

Description

Lefthook supports the root option for individual jobs, but not at the group level.

It should be possible to define a working directory once for all jobs nested in a group:

pre-push:
  jobs:
    - name: Django
      group:
        root: src/
        jobs:
          - name: System check
            run: uv run manage.py check
          - name: Migration check
            run: uv run manage.py makemigrations --check

The group-level root value should be inherited by every nested job, while an explicit root on a nested job should override the inherited value.

What problem it is solving?

Related jobs often operate in the same subdirectory, especially in monorepos or projects whose application code is not located at the repository root. Without group-level root support, the same value must be repeated for every nested job or each command must manually change its working directory.

Supporting root on groups would reduce configuration duplication, keep the shared execution context close to the group definition, and make nested job configurations easier to maintain. Updating the working directory would require changing it in only one place and would be less likely to leave one job configured inconsistently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestA new lefthook feature description

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions