-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (38 loc) · 1.39 KB
/
update-list.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
name: Update list
on:
schedule:
- cron: '35 11 * * *'
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install -U pip
pip install -r requirements.txt
- name: Update list
run: python scrape.py
- name: Push update to Telegram and commit updated list to GitHub
env:
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
CHAT_ID: ${{ secrets.CHAT_ID }}
run: |
GIT_CHANGED=$(git status --porcelain)
if [[ $GIT_CHANGED ]]; then
RESULT=$(git diff -U0 list.csv | grep '^[+-]' | grep -Ev '^(--- a/|\+\+\+ b/)' | sed 's/^[+]//g' | perl -pe 's/^(\d+)-(\d+)-(\d+),(.+),(.+)$/aria2c -x16 -s16 -c -o \1\2\3.mp4 \5/g')
curl -s -S "https://api.telegram.org/$BOT_TOKEN/sendMessage" -d "chat_id=$CHAT_ID" -d "text=\`\`\`
$RESULT
\`\`\`" -d 'parse_mode=MarkdownV2' > /dev/null
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add .
git commit -m 'Update list'
git push -u origin main
fi