Skip to content

Chargers Bot

Chargers Bot #564

Workflow file for this run

name: Chargers Bot
on:
schedule:
# Run every 6 hours (at minutes 0 past hours 0, 6, 12, 18)
- cron: '0 */6 * * *'
workflow_dispatch: # Allows manual triggering from GitHub Actions tab
jobs:
run-bot:
runs-on: ubuntu-latest
permissions:
contents: write # Needed to commit and push posted_articles.txt
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Run bot
env:
TWITTER_API_KEY: ${{ secrets.TWITTER_API_KEY }}
TWITTER_API_SECRET: ${{ secrets.TWITTER_API_SECRET }}
TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
TWITTER_BEARER_TOKEN: ${{ secrets.TWITTER_BEARER_TOKEN }}
CHECK_INTERVAL_HOURS: ${{ secrets.CHECK_INTERVAL_HOURS || '6' }}
DEBUG: ${{ secrets.DEBUG || 'False' }}
run: |
python bot.py
- name: Commit and push posted_articles.txt if changed
if: always()
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git pull --rebase || true
git add posted_articles.txt
if ! git diff --staged --quiet; then
git commit -m "Update posted_articles.txt [skip ci]"
git push
else
echo "No changes to posted_articles.txt"
fi