Update Latest Videos #16220
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 Latest Videos | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 0 * * *" # Run every day at 5:30 AM IST | |
| jobs: | |
| youtube-workflow: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/[email protected] | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install dependencies | |
| run: | | |
| npm install googleapis | |
| - name: Fetch and update videos | |
| run: | | |
| node .github/scripts/updateVideos.mjs | |
| env: | |
| YOUTUBE_API_KEY: ${{ secrets.YOUTUBE_API_KEY }} | |
| YOUTUBE_CHANNEL_ID: ${{ secrets.YOUTUBE_CHANNEL_ID }} | |
| YOUTUBE_CHANNEL_ID_BANGLA: ${{ secrets.YOUTUBE_CHANNEL_ID_BANGLA }} | |
| - name: Commit and push changes | |
| run: | | |
| git config --global user.email "[email protected]" | |
| git config --global user.name "GitHub Actions" | |
| git add . | |
| if git diff --cached --exit-code; then | |
| echo "No changes to commit." | |
| else | |
| git commit -m "Update latest videos" | |
| git pull --rebase origin main | |
| git push | |
| fi |