Skip to content

Commit 14dfeda

Browse files
author
Prakash Surya
authored
TOOL-12604 linux-pkg's "push-merge.sh" script does not work for internal github repositories (#216) (#233)
1 parent 8442950 commit 14dfeda

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

push-merge.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,14 @@ set -o pipefail
7676
echo "Running: git rev-parse refs/heads/repo-HEAD-saved"
7777
saved_ref=$(git rev-parse refs/heads/repo-HEAD-saved) ||
7878
die "Failed to read local ref refs/heads/repo-HEAD-saved"
79+
80+
git_url="$DEFAULT_PACKAGE_GIT_URL"
81+
if [[ -n "$FETCH_GIT_TOKEN" ]] && [[ "$git_url" == https://github.com/* ]]; then
82+
git_url="${git_url/https:\/\//https:\/\/${FETCH_GIT_TOKEN}@}"
83+
fi
84+
7985
echo "Running: git ls-remote $DEFAULT_PACKAGE_GIT_URL refs/heads/$DEFAULT_GIT_BRANCH"
80-
remote_ref=$(git ls-remote "$DEFAULT_PACKAGE_GIT_URL" "refs/heads/$DEFAULT_GIT_BRANCH" |
86+
remote_ref=$(git ls-remote "$git_url" "refs/heads/$DEFAULT_GIT_BRANCH" |
8187
awk '{print $1}') ||
8288
die "Failed to read remote ref refs/heads/$DEFAULT_GIT_BRANCH"
8389
set +o pipefail

0 commit comments

Comments
 (0)