From 557550c876ea7e8a0c3bbe38ddc9920f99d06478 Mon Sep 17 00:00:00 2001 From: Imri Paran Date: Fri, 19 Apr 2024 08:45:18 +0200 Subject: [PATCH] fixed exclusion for yaml/json validation (#15950) --- .github/workflows/validate-jsons-yamls.yml | 15 +-------------- scripts/validate_json_yaml.sh | 6 +++--- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/.github/workflows/validate-jsons-yamls.yml b/.github/workflows/validate-jsons-yamls.yml index af7cc27a131..1ad75ec2adb 100644 --- a/.github/workflows/validate-jsons-yamls.yml +++ b/.github/workflows/validate-jsons-yamls.yml @@ -77,20 +77,7 @@ jobs: pip install pyyaml ./scripts/validate_json_yaml.sh - - name: Create a comment in the PR with the instructions - if: steps.style.outcome != 'success' - uses: peter-evans/create-or-update-comment@v1 - with: - issue-number: ${{ github.event.pull_request.number }} - body: | - **JSON/YAML Validations failed.** - - Please run `./scripts/validate_json_yaml.sh` to find any bad json/yaml files and fix them. - You can also use [pre-commit](https://pre-commit.com/) to automate the Python code formatting. - - You can install the pre-commit hooks with `make install_test precommit_install`. - - - name: Python checkstyle failed, check the comment in the PR + - name: JSON/Yaml validation failed, check the comment in the PR if: steps.style.outcome != 'success' run: | exit 1 diff --git a/scripts/validate_json_yaml.sh b/scripts/validate_json_yaml.sh index 011031890ad..da78932d883 100755 --- a/scripts/validate_json_yaml.sh +++ b/scripts/validate_json_yaml.sh @@ -3,8 +3,8 @@ set -eup pipefail SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -EXCLUDED_DIRS="vscode" +EXCLUDED_DIRS=".vscode|great_expectations/resources" echo "Validating JSON files..." -git ls-files | grep "\.json$" | grep -vE "^($EXCLUDED_DIRS)/" | while read file; do jq . "$file" >/dev/null 2>&1 || { echo "Invalid JSON in $file"; exit 1; }; done +git ls-files | grep "\.json$" | grep -vE "/($EXCLUDED_DIRS)/" | while read file; do jq . "$file" >/dev/null 2>&1 || { echo "Invalid JSON in $file"; exit 1; }; done echo "Validating YAML files..." -git ls-files | grep -E "\.ya?ml$" | grep -vE "^($EXCLUDED_DIRS)/" | while read file; do python ${SCRIPT_DIR}/validate_yaml.py "$file" >/dev/null 2>&1 || { echo "Invalid YAML in $file"; exit 1; }; done +git ls-files | grep -E "\.ya?ml$" | grep -vE "/($EXCLUDED_DIRS)/" | while read file; do python ${SCRIPT_DIR}/validate_yaml.py "$file" >/dev/null 2>&1 || { echo "Invalid YAML in $file"; exit 1; }; done