Update Disney Tips #45
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: Update Disney Tips | |
| on: | |
| schedule: | |
| # Run daily at 6 AM UTC | |
| - cron: '0 6 * * *' | |
| workflow_dispatch: # Allow manual trigger | |
| concurrency: | |
| group: update-tips | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Fetch new videos | |
| env: | |
| APIFY_API_TOKEN: ${{ secrets.APIFY_API_TOKEN }} | |
| run: npm run fetch | |
| - name: Extract tips | |
| env: | |
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
| run: npm run extract | |
| - name: Commit and push if changed | |
| id: commit | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add data/ | |
| if git diff --staged --quiet; then | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| else | |
| git commit -m "Update tips $(date -u +%Y-%m-%d)" | |
| git push | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| fi | |