Skip to content

Update and Translate News Headlines Daily #528

Update and Translate News Headlines Daily

Update and Translate News Headlines Daily #528

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