From 6df203030f1df1e22cb8ae52d02cd876c88fef13 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sat, 10 Aug 2024 23:44:12 -0400 Subject: [PATCH] how about this? --- .github/workflows/mirror_to_gitlab.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/mirror_to_gitlab.yaml b/.github/workflows/mirror_to_gitlab.yaml index 6e7367eef1..15af25b475 100644 --- a/.github/workflows/mirror_to_gitlab.yaml +++ b/.github/workflows/mirror_to_gitlab.yaml @@ -18,7 +18,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.ref }} fetch-depth: 1 @@ -43,6 +43,8 @@ jobs: run: | # Add GitLab remote git remote add gitlab git@gitlab.com:sunnypilot/sunnyhaibin/sunnypilot-github-mirror.git - git push --force gitlab ${{ github.ref }}:${{ github.ref_name }} || \ - (git push --set-upstream gitlab ${{ github.ref_name }} && \ - git push --force gitlab ${{ github.ref }}:${{ github.ref_name }}) + git fetch gitlab ${{ github.ref_name }} || true # Allow fetch to fail if branch doesn't exist + + git rebase gitlab/${{ github.ref_name }} || true + + git push --force gitlab ${{ github.ref_name }}