Skip to content

Download Source; Build the Feed #395

Download Source; Build the Feed

Download Source; Build the Feed #395

name: "Download Source; Build the Feed"
on:
push:
workflow_dispatch:
schedule:
- cron: '0 2,14 * * *' # every day at noon UTC plus two hours, since COTA publishes their stuff around 9 a.m. Eastern. Also at 10 p.m. Eastern to catch evening updates before the morning commute.
permissions:
contents: write
jobs:
Download-and-Make:
runs-on: ubuntu-latest
steps:
- run: echo "ℹ️ The job was automatically triggered by a ${{ github.event_name }} event."
- name: Check out this repo
uses: actions/checkout@v4
- run: echo "ℹ️ The ${{ github.repository }} repository has been cloned to the runner."
- run: mkdir -p build/
- name: Fetch latest data from the API endpoint
run: |-
bash ./scraper.bash
- name: "Save files"
uses: actions/upload-artifact@v3
with:
name: acf-options.json
path: build/acf-options.json
- name: Parse scrape and update JSON
run: |-
php ./parser.php
- name: Generate RSS feed
run: |-
php ./rss.php > rss.xml
- name: "Save files"
uses: actions/upload-artifact@v4
with:
name: acf-options.json
path: build/acf-options.json
if-no-files-found: error
- name: "🛑 Preserve php errors"
uses: actions/upload-artifact@v4
if: failure()
with:
name: php-error.log
path: |
./php-error.log
./alerts-log.csv
./build/*
- name: "▶️ Commit and push if the data has changed"
run: |-
git config user.name "Automated"
git config user.email "[email protected]"
git add -A
timestamp=$(date -u)
git commit -m "Latest data: ${timestamp}" || exit 0
git pull --rebase
git push