Get recent youtube videos #868
This file contains 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: Get recent youtube videos | |
on: | |
schedule: | |
- cron: "0 15 * * *" | |
push: | |
paths: | |
- ".github/scripts" | |
workflow_dispatch: | |
jobs: | |
fetch-youtube: | |
name: Get recent youtube videos | |
runs-on: ubuntu-latest | |
outputs: | |
status: ${{ steps.commit.outputs.status }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "22" | |
check-latest: true | |
registry-url: https://registry.npmjs.org/ | |
- name: Install dependencies | |
run: npm ci | |
- name: Run script | |
run: bash .github/scripts/fetch-youtube.sh | |
env: | |
DISCORD_WEBHOOK_URI: ${{ secrets.DISCORD_WEBHOOK_URI }} | |
- name: Commit | |
id: commit | |
run: bash .github/scripts/commit.sh "$GITHUB_OUTPUT" | |
env: | |
TOKEN: ${{ secrets.TOKEN }} | |
REPOSITORY: ${{ github.repository }} | |
DISCORD_WEBHOOK_URI: ${{ secrets.DISCORD_WEBHOOK_URI }} | |
MESSAGE: "Update YouTube video list" | |
trigger-deploy: | |
runs-on: ubuntu-latest | |
needs: ["fetch-youtube"] | |
if: ${{ needs.fetch-youtube.outputs.status == 'TRUE' }} | |
name: Trigger deploy workflow | |
steps: | |
- uses: actions/github-script@v6 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
script: | | |
github.rest.actions.createWorkflowDispatch({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
workflow_id: 'deploy.yml', | |
ref: 'master', | |
}) |