Skip to content

Download, error-check and commit file #10989

Download, error-check and commit file

Download, error-check and commit file #10989

name: Download, error-check and commit file
# Controls when the workflow will run
on:
schedule:
- cron: '1/30 * * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# This workflow is set to attempt to download the latest AirNow .geojson
# But it first checks to ensure the file is present before replacing it
# Open work: alert team if the file is not present/replaced for an extended period of time
jobs:
download-and-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download and check file
run: |
error=true
while [ "$error" = true ]; do
curl -o "data/airnow_aq_raw.geojson" "https://services.arcgis.com/cJ9YHowT8TU7DUyn/arcgis/rest/services/AirNowLatestContoursCombined/FeatureServer/0/query?where=0%3D0&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&resultType=none&distance=0.0&units=esriSRUnit_Meter&returnGeodetic=false&outFields=*&returnGeometry=true&returnCentroid=false&featureEncoding=esriDefault&multipatchOption=xyFootprint&maxAllowableOffset=&geometryPrecision=&outSR=&datumTransformation=&applyVCSProjection=false&returnIdsOnly=false&returnUniqueIdsOnly=false&returnCountOnly=false&returnExtentOnly=false&returnQueryGeometry=false&returnDistinctValues=false&cacheHint=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&having=&resultOffset=&resultRecordCount=&returnZ=false&returnM=false&returnExceededLimitFeatures=true&quantizationParameters=&sqlFormat=none&f=pgeojson"
if grep -q 'error' data/airnow_aq_raw.geojson; then
error=true
else
error=false
fi
done
- name: Copy file if no error
run: |
cp data/airnow_aq_raw.geojson data/airnow_aq.geojson
- name: Commit file
uses: EndBug/add-and-commit@v7
with:
message: 'Add airnow_aq.geojson'
add: 'data/airnow_aq.geojson'