diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index bec0df5d..43efcd06 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -17,4 +17,4 @@ jobs: # Pre-check the json - name: Json Precheck - run: python _scripts/json_checker.py \ No newline at end of file + run: python precheck.py \ No newline at end of file diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 334a312b..425fa7d2 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -19,7 +19,7 @@ jobs: # Pre-check the json - name: Json Precheck - run: python _scripts/json_checker.py + run: python precheck.py # Dispatch the parser - name: Repository Dispatch diff --git a/_scripts/json_checker.py b/_scripts/json_checker.py index 083bcd57..e8218c6f 100644 --- a/_scripts/json_checker.py +++ b/_scripts/json_checker.py @@ -5,7 +5,6 @@ import uuid import pprint -filepath = ".." LOGGER = logging.getLogger() logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) ALL_UUID = [] @@ -72,13 +71,18 @@ def traverse_path(namespace: list): traverse_path(namespace + [folder]) -traverse_path([filepath]) +def run(filepath): + traverse_path([filepath]) -if len(ERROR_JSON) != 0: - print("ERROR JSON:") - pprint.pprint(ERROR_JSON) -if len(CONFLICTED_JSON) != 0: - print("CONFLICTED JSON:") - pprint.pprint(CONFLICTED_JSON) -if len(ERROR_JSON) != 0 or len(CONFLICTED_JSON) != 0: - raise AssertionError + if len(ERROR_JSON) != 0: + print("ERROR JSON:") + pprint.pprint(ERROR_JSON) + if len(CONFLICTED_JSON) != 0: + print("CONFLICTED JSON:") + pprint.pprint(CONFLICTED_JSON) + if len(ERROR_JSON) != 0 or len(CONFLICTED_JSON) != 0: + raise AssertionError + + +if __name__ == "__main__": + run("..") diff --git a/precheck.py b/precheck.py new file mode 100644 index 00000000..15d70d4f --- /dev/null +++ b/precheck.py @@ -0,0 +1,3 @@ +import _scripts.json_checker + +_scripts.json_checker.run(".")