-
Notifications
You must be signed in to change notification settings - Fork 0
28 lines (27 loc) · 993 Bytes
/
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
name: update-article-count
on:
push:
branches: ["main"]
schedule:
- cron: 0 0 * * *
workflow_dispatch:
jobs:
fetch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up directory and environment
run: |
git config user.name 'Actions'
git config user.email '[email protected]'
echo "$GITHUB_WORKSPACE" && cd "$GITHUB_WORKSPACE"
- name: Fetch data from YTWiki's API
run: |
int=$(curl 'https://youtube.fandom.com/api.php?action=query&format=json&meta=siteinfo&formatversion=latest&siprop=statistics' | jq --raw-output '.query.statistics.articles')
echo "{\"int\":$int}" > count.json
- name: Commit change
run: |
git add count.json
git commit -m "Fetched today's article count" || echo 'Source is the same as repository. Skipping push...'
git push -u origin main
echo 'Job done!'