From 7c87a8ab8f0b6b198aa6558967d701d3f2785a8f Mon Sep 17 00:00:00 2001 From: Chris Christiansen Date: Sun, 28 Jun 2026 21:24:46 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20mirror-to-github.sh=20p=C3=A5=20VM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/mirror-to-github.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 scripts/mirror-to-github.sh diff --git a/scripts/mirror-to-github.sh b/scripts/mirror-to-github.sh new file mode 100755 index 0000000..04a046b --- /dev/null +++ b/scripts/mirror-to-github.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +set -euo pipefail +OSVAUCO_DIR="${OSVAUCO_DIR:-$HOME/OSVauco}" +GOOGLE_CLOUD_PROJECT="${GOOGLE_CLOUD_PROJECT:-propane-will-491900-m5}" +GITHUB_REPO="https://github.com/vauco-saas/OSVauco.git" +cd "$OSVAUCO_DIR" +if [[ -z "${GITHUB_TOKEN:-}" ]]; then + GITHUB_TOKEN=$(gcloud secrets versions access latest + --secret="github-token" --project="$GOOGLE_CLOUD_PROJECT" 2>/dev/null || echo "") + [[ -z "$GITHUB_TOKEN" ]] && echo "ERROR: github-token mangler" && exit 1 + export GITHUB_TOKEN +fi +GITHUB_URL="https://x-access-token:${GITHUB_TOKEN}@github.com/vauco-saas/OSVauco.git" +git remote get-url github &>/dev/null && git remote set-url github "$GITHUB_URL" || git remote add github "$GITHUB_URL" +BRANCH=$(git branch --show-current 2>/dev/null || echo "main") +git push github "${BRANCH}:${BRANCH}" --force && echo "✅ Speilet til GitHub" +git remote set-url github "$GITHUB_REPO"