name: Sync changes to GitLab

on:
  push:
    branches: [main]

jobs:
  build:
    if: (github.repository == 'adamlui/chatgpt-infinity')
    runs-on: ubuntu-24.04
    permissions:
      contents: read
    env:
      TZ: PST8PDT

    steps:

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

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