From d9a08751961f0c65505a253e0813b94f4fd23b77 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Fri, 7 Jun 2024 15:15:22 -0500
Subject: [PATCH] Add mirror_github_to_gitlab

---
 ci-support.sh | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/ci-support.sh b/ci-support.sh
index 4b415f1..85a5c68 100644
--- a/ci-support.sh
+++ b/ci-support.sh
@@ -921,4 +921,21 @@ function test_downstream()
 # }}}
 
 
+# {{{ gitlab mirror
+
+function mirror_github_to_gitlab()
+{
+  mkdir ~/.ssh && echo -e "Host gitlab.tiker.net\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
+  eval $(ssh-agent) && echo "$GITLAB_AUTOPUSH_KEY" | ssh-add -
+  git fetch --unshallow
+  TGT_BRANCH="${GITHUB_REF#refs/heads/}"
+  echo "pushing to $TGT_BRANCH..."
+  TGT_REPO="git@gitlab.tiker.net:inducer/$(get_proj_name).git"
+  git push "$TGT_REPO" "$TGT_BRANCH"
+  git push "$TGT_REPO" --tags
+}
+
+# }}}
+
+
 # vim: foldmethod=marker:sw=2
-- 
GitLab