Generate AI News #116
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: Generate AI News | |
| on: | |
| schedule: | |
| # Every 6 hours | |
| - cron: "0 */4 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| generate-news: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Generate News | |
| env: | |
| GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }} | |
| run: | | |
| echo "Starting generation..." | |
| date | |
| npm run generate-news | |
| echo "Finished generation..." | |
| date | |
| - name: Commit Updated News | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add public/generated/news.json | |
| git diff --staged --quiet || git commit -m "Update AI news" | |
| - name: Push Changes | |
| run: git push |