ci: trigger bot on push to main branch #4
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: News Bot | |
| on: | |
| push: | |
| branches: | |
| - main | |
| schedule: | |
| - cron: '0 */3 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| run-bot: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: pip install -r requirements.txt | |
| - name: Test token | |
| env: | |
| GIT_TOKEN: ${{ secrets.GIT_TOKEN }} | |
| run: | | |
| echo "Token empieza con: ${GIT_TOKEN:0:10}" | |
| curl -s -o /dev/null -w "%{http_code}" \ | |
| -H "Authorization: Bearer $GIT_TOKEN" \ | |
| https://api.github.com/repos/DevCop95/cYHBernews/contents/noticias.json | |
| - name: Run bot | |
| env: | |
| TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} | |
| TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} | |
| UNSPLASH_ACCESS_KEY: ${{ secrets.UNSPLASH_ACCESS_KEY }} | |
| GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }} | |
| GIT_TOKEN: ${{ secrets.GIT_TOKEN }} | |
| VERIFY_TOKEN: ${{ secrets.VERIFY_TOKEN }} | |
| run: python run_job.py |