Skip to content
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

feat: add jobs option #861

Merged
merged 12 commits into from
Dec 19, 2024
Merged

Conversation

mrexox
Copy link
Member

@mrexox mrexox commented Oct 31, 2024

Closes #132

⚡ Summary

  • Add jobs and group new options, so recursive piped/parallel flows could be built
  • Implement the same run logic for jobs as for commands and scripts
  • Properly merge jobs options with lefthook-local.yml and extends
  • Add unit tests
  • Add integration tests
  • Add docs

Old syntax

pre-commit:
  parallel: true
  commands:
    lint:
      run: yarn lint
      stage_fixed: true
    fix-typos:
      run: typos
    migrate:
      run: lefthook run migrate
  scripts:
    "graphql-generate.sh":
      runner: bash

migrate:
  piped: true
  commands:
    setup:
      run: yarn setup
      priority: 1
    migrate:
      run: yarn migrate
      priority: 2

New syntax

pre-commit:
  parallel: true
  jobs:
    - name: lint
      run: yarn lint
      stage_fixed: true
    - run: typos
    - script: graphql-generate.sh
      runner: bash
    - name: migrate 
      group:
        piped: true
        jobs:
          - run: yarn setup
          - run: yarn migrate

@VanTanev
Copy link

VanTanev commented Nov 1, 2024

Hey, a question here: Re do[].group.do[] items the same as do[] items?

In this case, the nested items don't have a name - is it valid for the top level items to also omit a name, and what happens then, is the name just the value of run?

btw I think this new config format is pretty neat.

@mrexox
Copy link
Member Author

mrexox commented Nov 2, 2024

Yes, name is optional. The only mandatory options are either run, script, or group. run or script value will be used if name is empty, and for a group without a name it will be the index of a group - [3]

@mrexox mrexox force-pushed the feat/add-recursive-do-option branch from bd4c85e to 722b6aa Compare November 6, 2024 07:36
@mrexox mrexox changed the title feat: add recursive do option feat: add recursive actions option Dec 4, 2024
@mrexox mrexox force-pushed the feat/add-recursive-do-option branch from 722b6aa to 51f32aa Compare December 4, 2024 08:01
@mrexox mrexox force-pushed the feat/add-recursive-do-option branch from 68a5e0e to 4da9947 Compare December 11, 2024 15:37
@mrexox mrexox force-pushed the feat/add-recursive-do-option branch from 4da9947 to 31458a6 Compare December 19, 2024 12:09
@mrexox mrexox changed the title feat: add recursive actions option feat: add jobs option Dec 19, 2024
@mrexox mrexox force-pushed the feat/add-recursive-do-option branch from 31458a6 to e2387d0 Compare December 19, 2024 12:24
@mrexox mrexox marked this pull request as ready for review December 19, 2024 15:13
@mrexox mrexox force-pushed the feat/add-recursive-do-option branch from a57d7e8 to 20d995d Compare December 19, 2024 18:58
@mrexox mrexox merged commit 73d28b7 into evilmartians:master Dec 19, 2024
16 of 20 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.

Order of scripts and command
2 participants