Skip to content

Commit f257d06

Browse files
committed
f
1 parent 5a056a4 commit f257d06

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

.github/CONTRIBUTING.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,21 @@
1919

2020
```bash
2121
pre-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
```

.github/workflows/ci-cd.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)