From 1e8264a020553a4e6baf6c3b76146e6a0150c24b Mon Sep 17 00:00:00 2001 From: Alex Tsernoh Date: Tue, 5 Apr 2022 11:53:53 +0100 Subject: [PATCH 1/5] Initial action --- .github/wokflows/github-actions.yml | 12 ++++++++++++ tools/validate_json.py | 5 +++++ 2 files changed, 17 insertions(+) create mode 100644 .github/wokflows/github-actions.yml create mode 100644 tools/validate_json.py diff --git a/.github/wokflows/github-actions.yml b/.github/wokflows/github-actions.yml new file mode 100644 index 00000000..252f2c1f --- /dev/null +++ b/.github/wokflows/github-actions.yml @@ -0,0 +1,12 @@ +name: GitHub Actions Demo +on: [push] +jobs: + Validate-JSON: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - name: Validate JSON + run: | + chmod +x ${{ github.workspace }}/tools/validate_json.py + python3 ${{ github.workspace }}/tools/validate_json.py \ No newline at end of file diff --git a/tools/validate_json.py b/tools/validate_json.py new file mode 100644 index 00000000..e7bcac32 --- /dev/null +++ b/tools/validate_json.py @@ -0,0 +1,5 @@ +import json + +json.load(open("./../web/atlas.json")) + +print("JSON is valid") \ No newline at end of file From 5108f7ff36c9d81b03c3102dec7dfecd95b06c56 Mon Sep 17 00:00:00 2001 From: Alex Tsernoh Date: Tue, 5 Apr 2022 11:57:19 +0100 Subject: [PATCH 2/5] stupid typo --- .github/{wokflows => workflows}/github-actions.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{wokflows => workflows}/github-actions.yml (100%) diff --git a/.github/wokflows/github-actions.yml b/.github/workflows/github-actions.yml similarity index 100% rename from .github/wokflows/github-actions.yml rename to .github/workflows/github-actions.yml From 8ed9659cdb7af2e74a0a64a4c28c8faa16c9fe05 Mon Sep 17 00:00:00 2001 From: Alex Tsernoh Date: Tue, 5 Apr 2022 12:02:43 +0100 Subject: [PATCH 3/5] make path to atlas a variable --- .github/workflows/github-actions.yml | 2 +- tools/validate_json.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 252f2c1f..495a05ad 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -9,4 +9,4 @@ jobs: - name: Validate JSON run: | chmod +x ${{ github.workspace }}/tools/validate_json.py - python3 ${{ github.workspace }}/tools/validate_json.py \ No newline at end of file + python3 ${{ github.workspace }}/tools/validate_json.py$ {{ github.workspace }}/web/atlas.json \ No newline at end of file diff --git a/tools/validate_json.py b/tools/validate_json.py index e7bcac32..64e5b7c8 100644 --- a/tools/validate_json.py +++ b/tools/validate_json.py @@ -1,5 +1,14 @@ +#!/usr/bin/python + +import sys import json -json.load(open("./../web/atlas.json")) +path = "./../web/atlas.json" + +# path override as 1st param: validate_json.py path_to_file.json +if (len(sys.argv) > 1): + path = sys.argv[1] + +json.load(open(path)) print("JSON is valid") \ No newline at end of file From c448fab01b26883921893df293ddfd765b8ba8a2 Mon Sep 17 00:00:00 2001 From: Alex Tsernoh Date: Tue, 5 Apr 2022 12:03:32 +0100 Subject: [PATCH 4/5] stupid typo again --- .github/workflows/github-actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 495a05ad..b0b408ef 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -9,4 +9,4 @@ jobs: - name: Validate JSON run: | chmod +x ${{ github.workspace }}/tools/validate_json.py - python3 ${{ github.workspace }}/tools/validate_json.py$ {{ github.workspace }}/web/atlas.json \ No newline at end of file + python3 ${{ github.workspace }}/tools/validate_json.py ${{ github.workspace }}/web/atlas.json \ No newline at end of file From 1b877ec12f3169d2baeda07d02e80f56c83dd926 Mon Sep 17 00:00:00 2001 From: Alex Tsernoh Date: Tue, 5 Apr 2022 12:04:50 +0100 Subject: [PATCH 5/5] run on pull requests --- .github/workflows/github-actions.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index b0b408ef..9928c584 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -1,5 +1,5 @@ -name: GitHub Actions Demo -on: [push] +name: Validate JSON +on: [push, pull_request] jobs: Validate-JSON: runs-on: ubuntu-latest