From 6922733905b281e708d7ed1f16480fa266e080e0 Mon Sep 17 00:00:00 2001 From: Giles Hutton Date: Wed, 20 Apr 2022 12:28:39 +0100 Subject: [PATCH] Adds ability to pass arguments to circleci config validate (#5) * Adds ability to pass arguments to circleci config validate * Adds documentation for setting arguments, specifically org-slug --- README.md | 14 ++++++++++++++ circleci_validate.sh | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c31c1df..58972c0 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/circleci_validate.sh b/circleci_validate.sh index 1598fe7..d832e65 100755 --- a/circleci_validate.sh +++ b/circleci_validate.sh @@ -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 \ No newline at end of file +fi