File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed
Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change 1919
2020``` bash
2121pre-commit try-repo {-a} /path/to/local/pre-commit-terraform/repo {hook_name}
22- ` ` ` g run on this fork
22+ ```
23+
24+ I.e.
25+
26+ ``` bash
27+ pre-commit try-repo /mnt/c/Users/tf/pre-commit-terraform terraform_fmt # Run only `terraform_fmt` check
28+ pre-commit try-repo -a ~ /pre-commit-terraform # run all existing checks from repo
29+ ```
30+
31+ Running ` pre-commit ` with ` try-repo ` ignores all arguments specified in ` .pre-commit-config.yaml ` .
32+
33+ If you need to test hook with arguments, follow [ pre-commit doc] ( https://pre-commit.com/#arguments-pattern-in-hooks ) to test hooks.
34+
35+ For example, to test that the [ ` terraform_fmt ` ] ( ../README.md#terraform_fmt ) hook works fine with arguments:
36+
2337``` bash
2438/tmp/pre-commit-terraform/terraform_fmt.sh --args=-diff --args=-write=false test-dir/main.tf test-dir/vars.tf
2539```
Original file line number Diff line number Diff line change @@ -86,10 +86,11 @@ jobs:
8686 runs-on : ubuntu-latest
8787 # Prevent run 'push' events for the branches in upstream repository as it
8888 # already covered by 'pull_request' event
89- if : (github.event_name == 'push' && github.repository == 'pre-commit/pre-commit-terraform' &&
90- github.branch == 'master') ||
91- (github.event_name == 'push' && github.repository != 'pre-commit/pre-commit-terraform') ||
92- github.event_name != 'push'
89+ if : >-
90+ !(github.event_name == 'push' &&
91+ github.repository == 'pre-commit/pre-commit-terraform' &&
92+ github.ref != 'refs/heads/master'
93+ )
9394
9495 timeout-minutes : 1
9596
You can’t perform that action at this time.
0 commit comments