Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push mirroring #1084

Merged
merged 5 commits into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/abidiff.sh
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
Expand Down
2 changes: 1 addition & 1 deletion .github/bot-base.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion .github/bot-pr-base.sh
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

Expand Down
2 changes: 1 addition & 1 deletion .github/bot-pr-format-base.sh
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

Expand Down
2 changes: 1 addition & 1 deletion .github/check-format.sh
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
Expand Down
2 changes: 1 addition & 1 deletion .github/format-rebase.sh
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

Expand Down
2 changes: 1 addition & 1 deletion .github/format.sh
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
Expand Down
2 changes: 1 addition & 1 deletion .github/label.sh
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

Expand Down
24 changes: 24 additions & 0 deletions .github/mirror.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/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
git config user.email "ginkgo.library@gmail.com"
git config user.name "Ginkgo Bot"
tcojean marked this conversation as resolved.
Show resolved Hide resolved

# 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 --prune gitlab HEAD:$BRANCH_NAME
2 changes: 1 addition & 1 deletion .github/rebase.sh
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

Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/mirror.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Mirroring
on: push

jobs:
to_gitlab:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: develop
fetch-depth: 0
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 }}