Skip to content

Scrape latest data #120517

Scrape latest data

Scrape latest data #120517

name: Scrape latest data
on:
push:
workflow_dispatch:
schedule:
- cron: '9,29,49 * * * *'
permissions:
contents: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
scheduled:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2
- name: Fetch latest data
run: |-
curl --max-time 30 --retry 3 --retry-delay 5 -sf https://www.pse.com/api/sitecore/OutageMap/AnonymoussMapListView | jq . > /tmp/outages.json
test -s /tmp/outages.json && jq -e . /tmp/outages.json > /dev/null
mv /tmp/outages.json outages.json
- name: Commit and push if it changed
run: |-
git config user.name "outage-detector"
git config user.email "actions@users.noreply.github.com"
git add -A
timestamp=$(date -u)
git commit -m "Latest data as of ${timestamp}" || exit 0
git push