Skip to content

daily-update

daily-update #651

Workflow file for this run

name: "daily-update"
on:
schedule:
- cron: "15 5 * * *"
jobs:
daily-update:
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- name: "Setup Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.x"
cache: "pip"
- name: "Setup dependencies"
run: |
pip install -r requirements.txt
- name: "Download `animetitles.json.lz4`"
run: |
mkdir -p 'data'
# Feel free to use this URL directly, but I don't guarantee any kind
# of availability.
#
# Also, this file only changes once a day, so don't go crazy with the
# requests.
#
# Ensure your HTTP client is able to use the `Cache-Control`, `ETag`,
# or `Last-Modified` headers from the HTTP response to avoid wasting
# unnecessary bandwidth.
(
curl \
--silent --show-error \
--fail --fail-early \
'https://ddl.c032.dev/anidb/animetitles.json.lz4'
) > 'data/animetitles.json.lz4'
- name: "Decompress `animetitles.json.lz4`"
run: |
rm -f 'data/animetitles.json'
lz4 -d --rm 'data/animetitles.json.lz4' 'data/animetitles.json'
- name: "Sanity check"
run: |
python check.py
- name: "`git config`"
run: |
git config user.name "GitHub Actions"
git config user.email "<>"
- name: "Commit and push"
run: |
git add --all -v 'data'
# Abort if there's nothing to commit.
git diff --cached --quiet && exit 0
git commit -m 'Daily update'
git push 'origin' 'main'