Skip to content

Auto Update

Auto Update #35

Workflow file for this run

name: Auto Update
on:
schedule:
- cron: '0 1 * * 1' # Runs at 01:00 AM every Monday
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Git
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- name: Set Branch Name
run: echo "BRANCH_NAME=stats_$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Checkout Branch
run: git checkout -b ${{ env.BRANCH_NAME }}
- name: Update stats
env:
API_KEY: ${{ secrets.YOUTUBE_API_KEY }}
run: php update.php
- name: Commit changes
run: |
git add .
git commit -m "Update stats" || echo "No changes to commit"
git push origin ${{ env.BRANCH_NAME }}
# Won't work until the permissions for GitHub actions are updated!
# - name: Create PR
# run: |
# gh auth login --with-token <<<"${{ secrets.GITHUB_TOKEN }}"
# gh pr create --base main --head ${{ env.BRANCH_NAME }} --title "[AUTO] Update stats" --body "_This PR includes automated changes._"