Skip to content

Commit

Permalink
Adds ability to pass arguments to circleci config validate (#5)
Browse files Browse the repository at this point in the history
* Adds ability to pass arguments to circleci config validate
* Adds documentation for setting arguments, specifically org-slug
  • Loading branch information
Stringy committed Apr 20, 2022
1 parent 7be19ef commit 6922733
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ $ cat .pre-commit-config.yaml
- id: circleci_validate
```

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.

For example, to set an org-slug:
```bash
$ cat .pre-commit-config.yaml
- repo: https://github.com/zahorniak/pre-commit-circleci.git
rev: v0.3 # Ensure this is the latest tag, comparing to the Releases tab
hooks:
- id: circleci_validate
args:
- --org-slug my/organization
```

## 3. Install hook
```bash
$ pre-commit install
Expand Down
4 changes: 2 additions & 2 deletions circleci_validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ then
exit 1
fi

if ! eMSG=$(circleci config validate -c .circleci/config.yml); then
if ! eMSG=$(circleci config validate $@ -c .circleci/config.yml); then
echo "CircleCI Configuration Failed Validation."
echo $eMSG
exit 1
fi
fi

0 comments on commit 6922733

Please sign in to comment.