-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
99 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Initialize Gitlab mirror | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
sync_to_gitlab: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Extract repository name | ||
id: extract_repo_name | ||
run: echo "::set-output name=reponame::$(echo $GITHUB_REPOSITORY | cut -d'/' -f2)" | ||
|
||
- name: Set up Git | ||
run: | | ||
git config --global user.name "${{ secrets.GITLAB_USER }}" | ||
git config --global user.email "${{ secrets.GITLAB_EMAIL }}" | ||
env: | ||
GITLAB_USER: ${{ secrets.GITLAB_USER }} | ||
GITLAB_EMAIL: ${{ secrets.GITLAB_EMAIL }} | ||
|
||
- name: Remove shallow update | ||
run: git fetch --prune --unshallow | ||
|
||
- name: Push to GitLab | ||
run: | | ||
git remote add gitlab https://oauth2:${{ secrets.GITLAB_TOKEN }}@gitlab.com/rmottanet/${{ steps.extract_repo_name.outputs.reponame }}.git | ||
git push --set-upstream gitlab --all | ||
git push --set-upstream gitlab --tags | ||
env: | ||
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Mirror | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
sync_to_gitlab: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Extract repository name | ||
id: extract_repo_name | ||
run: echo "::set-output name=reponame::$(echo $GITHUB_REPOSITORY | cut -d'/' -f2)" | ||
|
||
- name: Set up Git | ||
run: | | ||
git config --global user.name "${{ secrets.GITLAB_USER }}" | ||
git config --global user.email "${{ secrets.GITLAB_EMAIL }}" | ||
- name: Sync to GitLab | ||
run: | | ||
git remote add gitlab https://oauth2:${{ secrets.GITLAB_TOKEN }}@gitlab.com/rmottanet/${{ steps.extract_repo_name.outputs.reponame }}.git | ||
git fetch --prune --unshallow | ||
git checkout main | ||
git merge --allow-unrelated-histories -X theirs --no-edit origin/main | ||
git push gitlab main | ||
env: | ||
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
./python/.env/* | ||
./cpp/bin/* | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Mirroring on Github | ||
|
||
stages: | ||
- mirror | ||
|
||
mirror: | ||
stage: mirror | ||
script: | ||
- export REPO_NAME=$(echo $CI_PROJECT_PATH | cut -d'/' -f2) | ||
- git remote add github https://${GITHUB_TOKEN}@github.com/rmottanet/$REPO_NAME.git | ||
- git checkout -b main | ||
- git push --set-upstream github main | ||
rules: | ||
- if: '$CI_PIPELINE_SOURCE == "merge_request" && $CI_MERGE_REQUEST_EVENT_TYPE == "close"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters