-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds push mirroring for the current branch. The way it works is simple, add the GitLab remote, the ssh key, pull the branch from Github then force push to gitlab. Related PR: #1084
- Loading branch information
Showing
11 changed files
with
49 additions
and
9 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
pushd old | ||
source .github/bot-pr-base.sh | ||
|
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,4 +1,4 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
|
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,4 +1,4 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
source .github/bot-base.sh | ||
|
||
|
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,4 +1,4 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
source .github/bot-pr-base.sh | ||
|
||
|
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,4 +1,4 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
cp .github/bot-pr-format-base.sh /tmp | ||
source /tmp/bot-pr-format-base.sh | ||
|
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,4 +1,4 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
source .github/bot-pr-base.sh | ||
|
||
|
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,4 +1,4 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
cp .github/bot-pr-format-base.sh /tmp | ||
source /tmp/bot-pr-format-base.sh | ||
|
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,4 +1,4 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
source .github/bot-pr-base.sh | ||
|
||
|
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,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
BRANCH_NAME=${BRANCH_NAME##*/} | ||
|
||
git remote add fork "git@github.com:${GITHUB_REPO}.git" | ||
git remote add gitlab "git@gitlab.com:ginkgo-project/ginkgo-public-ci.git" | ||
|
||
git remote -v | ||
|
||
# Setup ssh | ||
eval $(ssh-agent -s) | ||
echo "${BOT_KEY}" | tr -d '\r' | ssh-add - >/dev/null | ||
mkdir -p ~/.ssh | ||
chmod 700 ~/.ssh | ||
ssh-keyscan -t rsa gitlab.com github.com >>~/.ssh/known_hosts | ||
|
||
# Fetch from github | ||
git fetch fork "$BRANCH_NAME" | ||
git checkout -B "$BRANCH_NAME" | ||
git reset --hard fork/"$BRANCH_NAME" | ||
# Push to gitlab | ||
git push -u --force gitlab HEAD:$BRANCH_NAME |
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,4 +1,4 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
source .github/bot-pr-base.sh | ||
|
||
|
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,18 @@ | ||
name: Mirroring | ||
on: push | ||
|
||
jobs: | ||
to_gitlab: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: develop | ||
persist-credentials: false | ||
- name: Push to Gitlab | ||
run: cp --preserve .github/mirror.sh /tmp && /tmp/mirror.sh | ||
env: | ||
BOT_KEY: ${{ secrets.GITLAB_MIRROR_PRIV_KEY }} | ||
BRANCH_NAME: ${{ github.ref }} | ||
GITHUB_REPO: ${{ github.repository }} |