-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (55 loc) · 1.84 KB
/
parse-and-generate.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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 "actions@users.noreply.github.com"
git add -A
timestamp=$(date -u)
git commit -m "Latest data: ${timestamp}" || exit 0
git pull --rebase
git push