Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxymVlasov committed Feb 17, 2025
1 parent 5a056a4 commit f257d06
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
16 changes: 15 additions & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,21 @@

```bash
pre-commit try-repo {-a} /path/to/local/pre-commit-terraform/repo {hook_name}
```g run on this fork
```

I.e.

```bash
pre-commit try-repo /mnt/c/Users/tf/pre-commit-terraform terraform_fmt # Run only `terraform_fmt` check
pre-commit try-repo -a ~/pre-commit-terraform # run all existing checks from repo
```

Running `pre-commit` with `try-repo` ignores all arguments specified in `.pre-commit-config.yaml`.

If you need to test hook with arguments, follow [pre-commit doc](https://pre-commit.com/#arguments-pattern-in-hooks) to test hooks.

For example, to test that the [`terraform_fmt`](../README.md#terraform_fmt) hook works fine with arguments:

```bash
/tmp/pre-commit-terraform/terraform_fmt.sh --args=-diff --args=-write=false test-dir/main.tf test-dir/vars.tf
```
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ jobs:
runs-on: ubuntu-latest
# Prevent run 'push' events for the branches in upstream repository as it
# already covered by 'pull_request' event
if: (github.event_name == 'push' && github.repository == 'pre-commit/pre-commit-terraform' &&
github.branch == 'master') ||
(github.event_name == 'push' && github.repository != 'pre-commit/pre-commit-terraform') ||
github.event_name != 'push'
if: >-
!(github.event_name == 'push' &&
github.repository == 'pre-commit/pre-commit-terraform' &&
github.ref != 'refs/heads/master'
)
timeout-minutes: 1

Expand Down

0 comments on commit f257d06

Please sign in to comment.