name: Sync changes to GitLab

on:
  push:
    branches: [main]

jobs:
  sync-changes:
    if: (github.repository == 'adamlui/youtube-classic')
    runs-on: ubuntu-24.04
    permissions:
      contents: read
    env:
      TZ: PST8PDT

    steps:

      - name: Checkout adamlui/youtube-classic
        uses: actions/checkout@v6.0.2
        with:
          fetch-depth: 0

      - name: Push changes to gitlab.com/adamlui/youtube-classic
        env:
          GITLAB_SYNC_PAT: ${{ secrets.GITLAB_SYNC_PAT }}
        run: |
          git push --force -o ci.skip \
            https://oauth2:$GITLAB_SYNC_PAT@gitlab.com/adamlui/youtube-classic.git main
