Skip to content

Commit cd880a7

Browse files
committed
feat: auto-fetch canonical pre-commit config in make test
1 parent 30b9165 commit cd880a7

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ Pre-commit configuration is **centralized** in `makeitworkcloud/images/tfroot-ru
1616

1717
For local development, run:
1818
```bash
19-
curl -sSL -o .pre-commit-config.yaml \
20-
https://raw.githubusercontent.com/makeitworkcloud/images/main/tfroot-runner/pre-commit-config.yaml
2119
make test
2220
```
2321

22+
This automatically fetches the canonical config if not present.
23+
2424
## Related Repositories
2525

2626
- `images` - Contains tfroot-runner image and canonical pre-commit config

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ help:
1919
@echo "-----------------"
2020
@echo
2121
@echo "\tinit: run 'terraform init'"
22-
@echo "\ttest: run pre-commmit checks"
22+
@echo "\ttest: fetch canonical pre-commit config and run checks"
2323
@echo "\tplan: run 'terraform plan'"
2424
@echo "\tapply: run 'terraform apply'"
2525
@echo "\tmigrate; run terraform init -migrate-state"
@@ -55,9 +55,13 @@ migrate:
5555
@echo "First use -make init- using the old S3 backend, then run -make migrate- to use the new one."
5656
@${TERRAFORM} init -migrate-state -backend-config="key=${S3_KEY}" -backend-config="bucket=${S3_BUCKET}" -backend-config="region=${S3_REGION}" -backend-config="access_key=${S3_ACCESS_KEY}" -backend-config="secret_key=${S3_SECRET_KEY}"
5757

58-
test: .git/hooks/pre-commit
58+
test: .pre-commit-config.yaml .git/hooks/pre-commit
5959
@pre-commit run -a
6060

61+
.pre-commit-config.yaml:
62+
@curl -sSL -o .pre-commit-config.yaml \
63+
https://raw.githubusercontent.com/makeitworkcloud/images/main/tfroot-runner/pre-commit-config.yaml
64+
6165
DEPS_PRE_COMMIT=$(shell which pre-commit || echo "pre-commit not found")
6266
DEPS_TERRAFORM_DOCS=$(shell which terraform-docs || echo "terraform-docs not found")
6367
DEPS_TFLINT=$(shell which tflint || echo "tflint not found,")

0 commit comments

Comments
 (0)