diff --git a/.github/abidiff.sh b/.github/abidiff.sh index 8c644dcfa38..bcc2e3bf8fe 100755 --- a/.github/abidiff.sh +++ b/.github/abidiff.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash pushd old source .github/bot-pr-base.sh diff --git a/.github/bot-base.sh b/.github/bot-base.sh index 608cd6d6308..58e3a6df7b5 100644 --- a/.github/bot-base.sh +++ b/.github/bot-base.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/.github/bot-pr-base.sh b/.github/bot-pr-base.sh index 11cd6526e11..8fe4f26f204 100644 --- a/.github/bot-pr-base.sh +++ b/.github/bot-pr-base.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash source .github/bot-base.sh diff --git a/.github/bot-pr-format-base.sh b/.github/bot-pr-format-base.sh index 9ef7aba26d7..53685f680f5 100644 --- a/.github/bot-pr-format-base.sh +++ b/.github/bot-pr-format-base.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash source .github/bot-pr-base.sh diff --git a/.github/check-format.sh b/.github/check-format.sh index 635b64c943f..96e3ea3616b 100755 --- a/.github/check-format.sh +++ b/.github/check-format.sh @@ -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 diff --git a/.github/format-rebase.sh b/.github/format-rebase.sh index b470da0d77f..6fe7aff6743 100755 --- a/.github/format-rebase.sh +++ b/.github/format-rebase.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash source .github/bot-pr-base.sh diff --git a/.github/format.sh b/.github/format.sh index 8829b719b8f..ab023e2fc7b 100755 --- a/.github/format.sh +++ b/.github/format.sh @@ -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 diff --git a/.github/label.sh b/.github/label.sh index aa6b4f13f75..c954b0123fe 100755 --- a/.github/label.sh +++ b/.github/label.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash source .github/bot-pr-base.sh diff --git a/.github/mirror.sh b/.github/mirror.sh new file mode 100755 index 00000000000..f7a407601f3 --- /dev/null +++ b/.github/mirror.sh @@ -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 diff --git a/.github/rebase.sh b/.github/rebase.sh index ef88df947d4..c0778254758 100755 --- a/.github/rebase.sh +++ b/.github/rebase.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash source .github/bot-pr-base.sh diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml new file mode 100644 index 00000000000..a9efec66e34 --- /dev/null +++ b/.github/workflows/mirror.yml @@ -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 }}