From d49bcbec73654fa6018274e9daf1314375b08363 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Thu, 8 Sep 2022 19:59:40 +0200 Subject: Added mirror to github script and job --- mirror-to-github/mirror-to-github.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 mirror-to-github/mirror-to-github.sh (limited to 'mirror-to-github/mirror-to-github.sh') diff --git a/mirror-to-github/mirror-to-github.sh b/mirror-to-github/mirror-to-github.sh new file mode 100644 index 0000000..f831f0c --- /dev/null +++ b/mirror-to-github/mirror-to-github.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Input environment: +# - REPO: The repository path part of the url to mirror, for example: adyxax/www +# Requires a github identity! + +WORKDIR="/tmp/$(basename ${REPO})" + +cleanup() { + rm -rf "${WORKDIR}" +} + +trap cleanup EXIT + +git clone -q "https://git.adyxax.org/${REPO}" "${WORKDIR}" +(cd ${WORKDIR}; git remote add github https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${REPO}; git push github --mirror) -- cgit v1.2.3