rationalise workflows

- csv-to-topo updater now only works for PRs : csv shouldn't be directly updated in a push to master
- csv-to-topo can now be manually triggered if needed
- clearer formatting for actions
This commit is contained in:
Hugh Rundle 2021-01-29 21:10:39 +11:00
parent 5e643b4ee3
commit 7a2b83a97c
3 changed files with 7 additions and 25 deletions

View file

@ -5,15 +5,19 @@ on:
- master - master
paths: paths:
- 'boundaries.geo.json' - 'boundaries.geo.json'
workflow_dispatch: workflow_dispatch:
jobs: jobs:
processJson: processJson:
if: "!contains(github.event.head_commit.message, 'from hughrun/geo-to-topo')" if: "!contains(github.event.head_commit.message, 'from hughrun/geo-to-topo')"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Update GeoJSON boundaries - name: Update GeoJSON boundaries
run: | run: |
sudo npm install -g mapshaper sudo npm install -g mapshaper
@ -21,6 +25,7 @@ jobs:
sudo npm install -g topojson-server sudo npm install -g topojson-server
geo2topo boundaries.geo.json -q 50000 > website/data/boundaries.topo.json geo2topo boundaries.geo.json -q 50000 > website/data/boundaries.topo.json
python3 ./.github/scripts/merge_csv_to_topojson.py python3 ./.github/scripts/merge_csv_to_topojson.py
- name: Create Pull Request - name: Create Pull Request
uses: peter-evans/create-pull-request@v3 uses: peter-evans/create-pull-request@v3
with: with:

View file

@ -5,6 +5,8 @@ on:
paths: paths:
- 'website/data/library_services_information.csv' - 'website/data/library_services_information.csv'
workflow_dispatch:
jobs: jobs:
auto-topo-updater: auto-topo-updater:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View file

@ -1,25 +0,0 @@
name: topo auto updater (push)
on:
push:
branches:
- "master"
paths:
- 'website/data/library_services_information.csv'
- '!website/data/boundaries.topo.json'
jobs:
auto-topo-updater:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Merge CSV to TopoJSON
run: |
python3 ./.github/scripts/merge_csv_to_topojson.py
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: merge csv data to topo