diff --git a/CHANGELOG.md b/CHANGELOG.md index 8864299e..47ba60bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,7 +42,7 @@ _None._ ### Bug Fixes -_None._ +- `run_swiftlint`: Error gracefully when `swiftlint_version` is missing in the `.swiftlint.yml` file [#139] ### Internal Changes diff --git a/README.md b/README.md index edabdcab..b9f0675c 100644 --- a/README.md +++ b/README.md @@ -26,11 +26,11 @@ steps: restore_cache $(hash_file package-lock.json) plugins: - - automattic/a8c-ci-toolkit#3.8.0: + - automattic/a8c-ci-toolkit#3.9.0: bucket: a8c-ci-cache # optional ``` -Don't forget to verify what [the latest release](https://github.com/Automattic/a8c-ci-toolkit-buildkite-plugin/releases/latest) is and use that value instead of `3.7.1`. +Don't forget to verify what [the latest release](https://github.com/Automattic/a8c-ci-toolkit-buildkite-plugin/releases/latest) is and use that value instead of `3.9.0`. ## Configuration diff --git a/bin/run_swiftlint b/bin/run_swiftlint index 9252f995..32572d32 100755 --- a/bin/run_swiftlint +++ b/bin/run_swiftlint @@ -21,6 +21,10 @@ if [[ $# -gt 0 ]]; then fi SWIFTLINT_VERSION="$(<.swiftlint.yml awk '/^swiftlint_version: / {print $2}')" +if [ -z "$SWIFTLINT_VERSION" ]; then + echo "Your \`.swiftlint.yml\` file must contain a key for \`swiftlint_version:\` so that we know which version of SwiftLint to use to lint your codebase." + exit 1 +fi SWIFTLINT_DOCKER_CMD=(docker run --rm -v "$PWD":/workspace -w /workspace ghcr.io/realm/swiftlint:"$SWIFTLINT_VERSION" swiftlint) set +e