From afc6323cb02f1a75b66a842d5157b5a7374a00f0 Mon Sep 17 00:00:00 2001 From: Andreas Skomski Date: Thu, 29 Aug 2024 07:53:48 +0200 Subject: [PATCH] action.sh: allow to change origin It's not possible to override a default environment variable --- action.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/action.sh b/action.sh index 5a12ee5..25ce0be 100755 --- a/action.sh +++ b/action.sh @@ -35,12 +35,19 @@ else export CONFIG_FILE="${GITHUB_WORKSPACE}/mkdocs.yml" fi +if [ -n "${GITHUB_ORIGIN}" ]; then + print_info "setup with GITHUB_ORIGIN" +else + print_info "setup with GITHUB_REPOSITORY" + export GITHUB_ORIGIN=${GITHUB_REPOSITORY} +fi + if [ -n "${GITHUB_TOKEN}" ]; then print_info "setup with GITHUB_TOKEN" - remote_repo="https://x-access-token:${GITHUB_TOKEN}@${GITHUB_DOMAIN:-"github.com"}/${GITHUB_REPOSITORY}.git" + remote_repo="https://x-access-token:${GITHUB_TOKEN}@${GITHUB_DOMAIN:-"github.com"}/${GITHUB_ORIGIN}.git" elif [ -n "${PERSONAL_TOKEN}" ]; then print_info "setup with PERSONAL_TOKEN" - remote_repo="https://x-access-token:${PERSONAL_TOKEN}@${GITHUB_DOMAIN:-"github.com"}/${GITHUB_REPOSITORY}.git" + remote_repo="https://x-access-token:${PERSONAL_TOKEN}@${GITHUB_DOMAIN:-"github.com"}/${GITHUB_ORIGIN}.git" else print_info "no token found; linting" exec -- mkdocs build --config-file "${CONFIG_FILE}"