-
Notifications
You must be signed in to change notification settings - Fork 1
74 lines (60 loc) · 2.13 KB
/
update_translate_news.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Update and Translate News Headlines Daily
on:
schedule:
- cron: '0 3 * * *' # Runs daily at 9:00 AM IST (3:30 AM UTC)
- cron: '30 9 * * *' # Runs daily at 3:00 PM IST (9:30 AM UTC)
- cron: '30 12 * * *' # Runs daily at 6:00 PM IST (12:30 PM UTC)
- cron: '30 15 * * *' # Runs daily at 9:00 PM IST (3:30 PM UTC)
- cron: '30 21 * * *' # Runs daily at 3:00 AM IST (9:30 PM UTC)
- cron: '30 18 * * *' # Runs daily at 12:00 AM IST (6:30 PM UTC previous day)
- cron: '30 0 * * *' # Runs daily at 6:00 AM IST (12:30 AM UTC)
workflow_dispatch: # Allows manual trigger
jobs:
update-news:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12.5'
- name: Install dependencies
run: |
pip install requests
- name: Run the script to update news_en.json
run: python networking/update_news.py
- name: Commit changes
run: |
git config --local user.name "suryadip2008"
git config --local user.email "suryadip.2008@gmail.com"
git add networking/news_en.json
git commit -m "bot(scripts): Daily News Update"
git push
translate-news:
needs: update-news # Dependency on update-news job to ensure it runs afterward
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12.5'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install translate
- name: Pull latest changes
run: |
git pull origin main --rebase
- name: Run translation script
run: |
python networking/translate_news.py
- name: Commit translated files
run: |
git config --global user.name "suryadip2008"
git config --global user.email "suryadip.2008@gmail.com"
git add networking/news_*.json
git commit -m "bot(scripts): News Translations"
git push