Skip to content

Commit

Permalink
Fix github action
Browse files Browse the repository at this point in the history
  • Loading branch information
dwilkie committed Jan 30, 2024
1 parent c28a342 commit 9bc8d72
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 29 deletions.
12 changes: 0 additions & 12 deletions .github/actions/fetch_data/action.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
name: Fetch Data
description: Fetches the latest data
inputs:
num_provinces:
description: Number of provinces to fetch
required: true
default: 25
url:
description: URL to fetch the data
required: true
default: 'http://db.ncdd.gov.kh/gazetteer/province/downloadprovince.castle?pv=${province_code}'
runs:
using: docker
image: Dockerfile
args:
- ${{ inputs.num_provinces }}
- ${{ inputs.url }}
11 changes: 5 additions & 6 deletions .github/actions/fetch_data/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
set -e
set -o pipefail

PLACEHOLDER='${province_code}'
URL="https://db.ncdd.gov.kh/gazetteer/province/downloadprovince.castle?pv=PROVINCE_CODE"
PLACEHOLDER="PROVINCE_CODE"
NUM_PROVINCES="25"

num_provinces=$1
url=$2

for province_code in `seq 1 $num_provinces`
for province_code in `seq 1 $NUM_PROVINCES`
do
province_url=$(echo $url | sed -e s/$PLACEHOLDER/$province_code/g)
province_url=$(echo $URL | sed -e s/$PLACEHOLDER/$province_code/g)
curl -s $province_url > "tmp/p$province_code.xls"
ssconvert "tmp/p$province_code.xls" "tmp/p$province_code.csv"
done
20 changes: 9 additions & 11 deletions .github/workflows/update_data.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Update Data

on:
schedule:
- cron: '0 2 * * 0'
on: push

jobs:
fetch_data:
Expand All @@ -22,14 +20,14 @@ jobs:
- name: Parse Data
run: ./bin/parse_data

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.REPO_TOKEN }}
commit-message: "feat: Update data"
title: "feat: Update data"
labels: "update_data"
base: "master"
# - name: Create Pull Request
# uses: peter-evans/create-pull-request@v5
# with:
# token: ${{ secrets.REPO_TOKEN }}
# commit-message: "feat: Update data"
# title: "feat: Update data"
# labels: "update_data"
# base: "master"

- name: Upload Data
uses: actions/upload-artifact@v4
Expand Down

0 comments on commit 9bc8d72

Please sign in to comment.