Unverified Commit 97a1fb9f authored by Yu Mingxi's avatar Yu Mingxi Committed by GitHub
Browse files

Delete .github/workflows/sync-to-gitlab.yml

parent 927fff57
Loading
Loading
Loading
Loading
+0 −49
Original line number Diff line number Diff line
name: Sync to GitLab

on:
  push:
    branches:
      - main
      - master

  # 允许手动触发,可选
  workflow_dispatch:

# 整个仓库的同步任务共用同一个并发组
concurrency:
  group: sync-to-gitlab
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  sync:
    runs-on: ubuntu-latest
    timeout-minutes: 5

    steps:
      # 防抖:如果 15 秒内又上传了图片,当前任务会被新任务取消
      - name: Wait for upload burst to finish
        run: sleep 15

      - name: Checkout source code
        uses: actions/checkout@v6
        with:
          fetch-depth: 0

      - name: Push to GitLab
        env:
          GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
          GITLAB_URL: ${{ secrets.GITLAB_URL }}
          GIT_TERMINAL_PROMPT: "0"
        run: |
          set -euo pipefail

          git remote add gitlab \
            "https://oauth2:${GITLAB_TOKEN}@${GITLAB_URL}"

          # 图床只同步当前主分支
          git push gitlab \
            "HEAD:refs/heads/${GITHUB_REF_NAME}" \
            --force