Skip to content

Commit 070c08c

Browse files
committed
preserves custom/authenticated remote
1 parent 6506e31 commit 070c08c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

action.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ runs:
4747
}
4848
4949
# --- Ensure we have enough history + refs ---
50-
# Make sure 'origin' is set (usually already set by actions/checkout)
51-
git remote set-url origin "${GITHUB_SERVER_URL:-https://github.com}/${GITHUB_REPOSITORY}.git" || true
50+
# Ensure 'origin' exists but never rewrite an existing remote URL/config.
51+
if ! git remote get-url origin >/dev/null 2>&1; then
52+
git remote add origin "${GITHUB_SERVER_URL:-https://github.com}/${GITHUB_REPOSITORY}.git"
53+
fi
5254
5355
if git rev-parse --is-shallow-repository >/dev/null 2>&1 && [[ "$(git rev-parse --is-shallow-repository)" == "true" ]]; then
5456
# Fully unshallow if possible so --contains works reliably

0 commit comments

Comments
 (0)