From 7efcd4759a9021f5b6e43fd1d65e60981558d3a8 Mon Sep 17 00:00:00 2001 From: Alex <12754559+a1ex4@users.noreply.github.com> Date: Thu, 19 Oct 2023 12:19:08 +0000 Subject: [PATCH] Add GA CI to check json files validity --- .github/workflows/main.yml | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..515d2d558 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,42 @@ +name: Check titledb files format validity + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + validate_json: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + name: Checkout latest commit + + - uses: actions/setup-python@v4 + name: Setup Python env + with: + python-version: '3.x' + - uses: jannekem/run-python-script-action@v1 + name: Check validity of json files + with: + script: | + import os + import json + + failed = [] + for json_file in sorted([f for f in os.listdir() if f.endswith('.json')]): + try: + with open(json_file) as f: + data = json.load(f) + print(f'{json_file} OK') + except: + print(f'{json_file} FAILED') + failed.append(json_file) + + if len(failed): + print('Files with incorrect format: \n - ' + '\n - '.join(failed)) + exit(1)