fixed exclusion for yaml/json validation (#15950)

This commit is contained in:
Imri Paran 2024-04-19 08:45:18 +02:00 committed by GitHub
parent d5b1465406
commit 557550c876
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 17 deletions

View File

@ -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

View File

@ -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