diff --git a/.github/workflows/mirror-repo.yml b/.github/workflows/mirror-repo.yml new file mode 100644 index 0000000000..ae1511275d --- /dev/null +++ b/.github/workflows/mirror-repo.yml @@ -0,0 +1,82 @@ +name: Mirror repo + +on: + workflow_call: + secrets: + GITLAB_URL: + required: true + GITLAB_USER: + required: true + GITLAB_PASSWORD: + required: true + +jobs: + mirror: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - id: mirror-1 + uses: yesolutions/mirror-action@master + continue-on-error: true + with: + REMOTE: ${{ secrets.GITLAB_URL }} + GIT_USERNAME: ${{ secrets.GITLAB_USER }} + GIT_PASSWORD: ${{ secrets.GITLAB_PASSWORD }} + + - run: sleep 60s + shell: bash + if: ${{ steps.mirror-1.outcome == 'failure' }} + + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + if: ${{ steps.mirror-1.outcome == 'failure' }} + - run: sudo git remote remove mirror || true + if: ${{ steps.mirror-1.outcome == 'failure' }} + - id: mirror-2 + uses: yesolutions/mirror-action@master + continue-on-error: true + with: + REMOTE: ${{ secrets.GITLAB_URL }} + GIT_USERNAME: ${{ secrets.GITLAB_USER }} + GIT_PASSWORD: ${{ secrets.GITLAB_PASSWORD }} + if: ${{ steps.mirror-1.outcome == 'failure' }} + + - run: sleep 60s + shell: bash + if: ${{ steps.mirror-2.outcome == 'failure' }} + + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + if: ${{ steps.mirror-2.outcome == 'failure' }} + - run: sudo git remote remove mirror || true + if: ${{ steps.mirror-2.outcome == 'failure' }} + - id: mirror-3 + uses: yesolutions/mirror-action@master + continue-on-error: true + with: + REMOTE: ${{ secrets.GITLAB_URL }} + GIT_USERNAME: ${{ secrets.GITLAB_USER }} + GIT_PASSWORD: ${{ secrets.GITLAB_PASSWORD }} + if: ${{ steps.mirror-2.outcome == 'failure' }} + + - run: sleep 60s + shell: bash + if: ${{ steps.mirror-3.outcome == 'failure' }} + + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + if: ${{ steps.mirror-3.outcome == 'failure' }} + - run: sudo git remote remove mirror || true + if: ${{ steps.mirror-3.outcome == 'failure' }} + - id: mirror-4 + uses: yesolutions/mirror-action@master + with: + REMOTE: ${{ secrets.GITLAB_URL }} + GIT_USERNAME: ${{ secrets.GITLAB_USER }} + GIT_PASSWORD: ${{ secrets.GITLAB_PASSWORD }} + if: ${{ steps.mirror-3.outcome == 'failure' }} diff --git a/.github/workflows/mirror_repo_to_gitlab.yml b/.github/workflows/mirror_repo_to_gitlab.yml new file mode 100644 index 0000000000..f5e7fc4784 --- /dev/null +++ b/.github/workflows/mirror_repo_to_gitlab.yml @@ -0,0 +1,11 @@ +name: Mirror repo to GitLab + +on: [push, delete] + +jobs: + call-dream-ops-mirror-workflow: + uses: ./.github/workflows/mirror-repo.yml + secrets: + GITLAB_URL: ${{ secrets.GITLAB_URL }} + GITLAB_USER: ${{ secrets.GITLAB_USER }} + GITLAB_PASSWORD: ${{ secrets.GITLAB_PASSWORD }}