Skip to content

Update Latest Videos #7719

Update Latest Videos

Update Latest Videos #7719

name: Update Latest Videos
on:
workflow_dispatch:
schedule:
- cron: "0 * * * *" # Run every day at 5:30 AM IST
jobs:
youtube-workflow:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "16"
- 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 }}
- name: Commit and push changes
run: |
git config --global user.email "actions@github.com"
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 origin main
git push
fi