diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 43d866f..5340876 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,7 +1,7 @@ - id: circleci_validate name: Validate CircleCI config - description: This hook validate CircleCI config + description: This hook validates CircleCI config entry: circleci_validate.sh language: script - files: .circleci/config.yml + files: .circleci/.*.yml pass_filenames: false diff --git a/README.md b/README.md index f49d063..6a1004d 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ $ cat .pre-commit-config.yaml If you wish to pass additional args to circleci_validate, you can specify them in the config. See `circleci config validate --help` for accepted args. +You must use the form `--arg=value`, not `--arg value`. For example, to set an org-slug: ```bash @@ -23,7 +24,18 @@ $ cat .pre-commit-config.yaml hooks: - id: circleci_validate args: - - --org-slug my/organization + - --org-slug=my/organization +``` + +Or specify a custom config file: +```bash +$ cat .pre-commit-config.yaml +- repo: https://github.com/zahorniak/pre-commit-circleci.git + rev: v0.5 # Ensure this is the latest tag, comparing to the Releases tab + hooks: + - id: circleci_validate + args: + - .circleci/continue_config.yml ``` ## 3. Install hook diff --git a/circleci_validate.sh b/circleci_validate.sh index 5695e68..a308577 100755 --- a/circleci_validate.sh +++ b/circleci_validate.sh @@ -12,7 +12,7 @@ then exit 1 fi -if ! eMSG=$(circleci config validate "$@" -c .circleci/config.yml); then +if ! eMSG=$(circleci config validate "$@"); then echo "CircleCI Configuration Failed Validation." echo "${eMSG}" exit 1