Daily Tech News Agent #59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Daily Tech News Agent | |
| on: | |
| schedule: | |
| - cron: '0 0,8 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| run-news-agent: | |
| 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.11' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; else pip install feedparser requests google-generativeai python-dotenv; fi | |
| - name: Pull latest history and changes | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git pull origin main || true | |
| - name: Run News Agent | |
| env: | |
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
| TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
| TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} | |
| run: | | |
| python news_agent.py | |
| - name: Commit and push updated news_history.json | |
| run: | | |
| git add news_history.json | |
| if git status --porcelain | grep -q "news_history.json"; then | |
| git commit -m "chore: update news_history.json [skip ci]" | |
| git push | |
| else | |
| echo "No changes to news_history.json" | |
| fi |