Daily Good News #317
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 Good News | |
| on: | |
| schedule: | |
| # Runs at 13:30 UTC daily (6:30am in Bay Area) | |
| - cron: "30 13 * * *" | |
| # Allows manual triggering | |
| workflow_dispatch: | |
| permissions: | |
| # Allows the workflow to write content to the repository (commit) | |
| contents: write | |
| jobs: | |
| generate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Generate good news | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| run: python scripts/good_news.py | |
| - name: Commit good news | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| git add . | |
| git commit -m "chore: add daily good news $(date -u +'%Y-%m-%d')" | |
| git push | |
| else | |
| echo "No changes to commit." | |
| fi |