-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add custom plain templates (#930)
- Loading branch information
Showing
12 changed files
with
106 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
## `templates` | ||
|
||
Provide custom replacement for templates in `run` values. | ||
|
||
With `templates` you can specify what can be overridden via `lefthook-local.yml` without a need to overwrite every jobs in your configuration. | ||
|
||
## Example | ||
|
||
### Override with lefthook-local.yml | ||
|
||
```yml | ||
# lefthook.yml | ||
|
||
templates: | ||
dip: # empty | ||
|
||
pre-commit: | ||
jobs: | ||
# Will run: `bundle exec rubocop file1 file2 file3 ...` | ||
- run: {dip} bundle exec rubocop {staged_files} | ||
``` | ||
```yml | ||
# lefthook.yml | ||
|
||
templates: | ||
dip: dip # Will run: `dip bundle exec rubocop file1 file2 file3 ...` | ||
``` | ||
### Reduce redundancy | ||
```yml | ||
# lefthook.yml | ||
|
||
templates: | ||
wrapper: docker-compose run --rm -v $(pwd):/app service | ||
|
||
pre-commit: | ||
jobs: | ||
- run: {wrapper} yarn format | ||
- run: {wrapper} yarn lint | ||
- run: {wrapper} yarn test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
exec git init | ||
exec lefthook run test | ||
stdout '^\s*hello\s*$' | ||
|
||
-- lefthook.yml -- | ||
templates: | ||
message: hello | ||
|
||
output: | ||
- execution_out | ||
|
||
test: | ||
jobs: | ||
- run: echo {message} |