diff --git a/.github/json_check.sh b/.github/json_check.sh new file mode 100755 index 0000000..db9bd9c --- /dev/null +++ b/.github/json_check.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +JSON_DIR=$1 +RC=0 + +for JSON_FILE in $(ls "$JSON_DIR"); do + jq type 1>/dev/null < "$JSON_DIR/$JSON_FILE" + if [ $? -gt 0 ]; then + echo "Error in file: $JSON_DIR/$JSON_FILE" + RC=1 + fi +done + +exit "$RC" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..9f761b5 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,18 @@ +--- +name: Lint + +on: + pull_request: + paths: + - "secjson/**/**" + +jobs: + build: + name: JSON lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + - name: Check JSON files + run: .github/json_check.sh secjson