From d3884a4e625285f8cc08bf052eda111161f6b0f8 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Tue, 26 Jan 2021 16:56:43 +1100 Subject: [PATCH] add github action scripts - moves python script to .github directory - also cleans up .gitignore --- .../scripts/merge_csv_to_topojson.py | 4 ++-- .github/workflows/merge-csv-to-topojson.yml | 24 +++++++++++++++++++ .gitignore | 2 -- 3 files changed, 26 insertions(+), 4 deletions(-) rename merge_to_topo.py => .github/scripts/merge_csv_to_topojson.py (89%) create mode 100644 .github/workflows/merge-csv-to-topojson.yml diff --git a/merge_to_topo.py b/.github/scripts/merge_csv_to_topojson.py similarity index 89% rename from merge_to_topo.py rename to .github/scripts/merge_csv_to_topojson.py index 71ba378..7272660 100644 --- a/merge_to_topo.py +++ b/.github/scripts/merge_csv_to_topojson.py @@ -3,8 +3,8 @@ import csv import json # files to merge -csv_file = 'website/data/library_services_information.csv' -topojson_file = 'website/data/boundaries.topo.json' +csv_file = '../../website/data/library_services_information.csv' +topojson_file = '../../website/data/boundaries.topo.json' geo = open(topojson_file, 'r') # open the topo.json file json_data = json.loads(geo.read()) # read the file and load into a dict diff --git a/.github/workflows/merge-csv-to-topojson.yml b/.github/workflows/merge-csv-to-topojson.yml new file mode 100644 index 0000000..829555c --- /dev/null +++ b/.github/workflows/merge-csv-to-topojson.yml @@ -0,0 +1,24 @@ +name: Merge CSV to TopoJSON +on: + push: + branches: + - master + paths: + - website/data/library_services_information.csv +jobs: + mergeData: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Merge CSV to TopoJSON + run: ./github/scripts/merge_csv_to_topojson.py + shell: python3 + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + commit-message: update TopoJSON + title: Update TopoJSON + body: Update boundaries.topo.json with new data from library_services_information.csv + branch: auto-update-topo \ No newline at end of file diff --git a/.gitignore b/.gitignore index ed062aa..7a2b6a0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ -*.xlsx -website/data/all_library_services.geojson website/data/boundaries.geojson website/secrets.js \ No newline at end of file -- 2.39.5