Skip to content

Commit

Permalink
Feat/gitlab synchronization (#616)
Browse files Browse the repository at this point in the history
* Add draft for repo mirroring

* Create mirror_repo_to_gitlab.yml

* Update mirror_repo_to_gitlab.yml

* Update mirror_repo_to_gitlab.yml

* Update mirror-repo.yml

* Update mirror-repo.yml
  • Loading branch information
NeoIsALie authored Jul 19, 2024
1 parent 855ccb2 commit a779137
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/mirror-repo.yml
Original file line number Diff line number Diff line change
@@ -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' }}
11 changes: 11 additions & 0 deletions .github/workflows/mirror_repo_to_gitlab.yml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit a779137

Please sign in to comment.