Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
dwilkie committed Jan 30, 2024
1 parent 9bc8d72 commit 5319514
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/actions/fetch_data/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ COPY entrypoint.sh /entrypoint.sh

# Code file to execute when the docker container starts up (`entrypoint.sh`)
ENTRYPOINT ["/entrypoint.sh"]
CMD [ "fetch-data" ]
22 changes: 13 additions & 9 deletions .github/actions/fetch_data/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
set -e
set -o pipefail

URL="https://db.ncdd.gov.kh/gazetteer/province/downloadprovince.castle?pv=PROVINCE_CODE"
PLACEHOLDER="PROVINCE_CODE"
NUM_PROVINCES="25"
if [ "$1" = 'fetch-data' ]; then
URL="https://db.ncdd.gov.kh/gazetteer/province/downloadprovince.castle?pv=PROVINCE_CODE"
PLACEHOLDER="PROVINCE_CODE"
NUM_PROVINCES="25"

for province_code in `seq 1 $NUM_PROVINCES`
do
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
for province_code in `seq 1 $NUM_PROVINCES`
do
province_url=$(echo $URL | sed -e s/$PLACEHOLDER/$province_code/g)
curl -k -s $province_url > "tmp/p$province_code.xls"
ssconvert "tmp/p$province_code.xls" "tmp/p$province_code.csv"
done
else
exec "$@"
fi

0 comments on commit 5319514

Please sign in to comment.