From 7b8f64842aec323a2d37ed1970bba47d1bc61c2a Mon Sep 17 00:00:00 2001 From: root Date: Fri, 3 Oct 2025 05:20:54 +0000 Subject: [PATCH] add auto mirror from gh to gl --- .github/workflows/gitlab-mirror.yml | 55 +++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/gitlab-mirror.yml diff --git a/.github/workflows/gitlab-mirror.yml b/.github/workflows/gitlab-mirror.yml new file mode 100644 index 0000000..31db4c7 --- /dev/null +++ b/.github/workflows/gitlab-mirror.yml @@ -0,0 +1,55 @@ +name: Full Mirror to GitLab + +on: + push: + branches: + - "**" + pull_request: + types: [opened, reopened, closed, edited] + issues: + types: [opened, edited, closed, reopened] + +jobs: + # ---- Mirror CODE ---- + mirror-code: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Push to GitLab + run: | + git remote add gitlab https://oauth2:${{ secrets.GITLAB_TOKEN }}@gitlab.com/foxixus/neomovies_mobile.git + git push --mirror gitlab + + # ---- Mirror ISSUES ---- + mirror-issues: + runs-on: ubuntu-latest + if: github.event_name == 'issues' + steps: + - name: Sync issue to GitLab + run: | + curl --request POST "https://gitlab.com/api/v4/projects/foxixus%2Fneomovies_mobile/issues" \ + --header "PRIVATE-TOKEN: ${{ secrets.GITLAB_TOKEN }}" \ + --header "Content-Type: application/json" \ + --data "{ + \"title\": \"${{ github.event.issue.title }}\", + \"description\": \"${{ github.event.issue.body }}\" + }" + + # ---- Mirror PULL REQUESTS as MERGE REQUESTS ---- + mirror-prs: + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + steps: + - name: Sync PR to GitLab MR + run: | + curl --request POST "https://gitlab.com/api/v4/projects/foxixus%2Fneomovies_mobile/merge_requests" \ + --header "PRIVATE-TOKEN: ${{ secrets.GITLAB_TOKEN }}" \ + --header "Content-Type: application/json" \ + --data "{ + \"title\": \"${{ github.event.pull_request.title }}\", + \"source_branch\": \"${{ github.event.pull_request.head.ref }}\", + \"target_branch\": \"${{ github.event.pull_request.base.ref }}\", + \"description\": \"${{ github.event.pull_request.body }}\" + }" \ No newline at end of file