-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (32 loc) · 1.07 KB
/
daily-update.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
name: daily-update
on:
schedule:
- cron: '38 4 * * *'
jobs:
daily-update:
runs-on: ubuntu-latest
environment: anidb
steps:
- name: 'Checkout'
uses: 'actions/checkout@v4'
- name: 'Download'
env:
CURL_USER_AGENT: ${{ secrets.CURL_USER_AGENT }}
run: |
mkdir -p "$(date +%Y)/$(date +%m)"
curl -vkL -H "User-Agent: $CURL_USER_AGENT" 'http://anidb.net/api/anime-titles.xml.gz' > "$(date +%Y)/$(date +%m)/$(date +%s).xml.gz"
- name: 'Update `latest.xml.gz`'
run: |
export MOST_RECENT_FILE=$(find . -iname '*.xml.gz' -print | egrep '/[0-9]+\.xml\.gz$' | sort | tail -1)
rm -f 'latest.xml.gz' 'latest.xml'
ln -v -s "$MOST_RECENT_FILE" 'latest.xml.gz'
gunzip < 'latest.xml.gz' > 'latest.xml'
- name: '`git config`'
run: |
git config user.name "GitHub Actions"
git config user.email "<>"
- name: 'Commit and push'
run: |
git add --all -v
git commit -m 'Daily update'
git push origin main