sync_repo_files: Normalize usage of git_user

Fix ./scripts/sync_repo_files.sh: line 141: GITHUB_USER: unbound variable

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
This commit is contained in:
Julien Pivotto 2021-02-24 21:10:21 +01:00
parent df80dc4d39
commit c0173072e2

View file

@ -45,10 +45,10 @@ push_branch() {
# stdout and stderr are redirected to /dev/null otherwise git-push could leak # stdout and stderr are redirected to /dev/null otherwise git-push could leak
# the token in the logs. # the token in the logs.
# Delete the remote branch in case it was merged but not deleted. # Delete the remote branch in case it was merged but not deleted.
git push --quiet "https://${GITHUB_TOKEN}:@github.com/${1}" \ git push --quiet "https://${git_user}:${GITHUB_TOKEN}:@github.com/${1}" \
":${branch}" 1>/dev/null 2>&1 ":${branch}" 1>/dev/null 2>&1
git push --quiet \ git push --quiet \
"https://${GITHUB_TOKEN}:@github.com/${1}" \ "https://${git_user}:${GITHUB_TOKEN}:@github.com/${1}" \
--set-upstream "${branch}" 1>/dev/null 2>&1 --set-upstream "${branch}" 1>/dev/null 2>&1
} }
@ -137,7 +137,7 @@ for org in ${orgs}; do
fetch_repos "${org}" | while read -r repo; do fetch_repos "${org}" | while read -r repo; do
# Check if a PR is already opened for the branch. # Check if a PR is already opened for the branch.
prLink=$(curl --show-error --silent \ prLink=$(curl --show-error --silent \
-u "${GITHUB_USER}:${GITHUB_TOKEN}" \ -u "${git_user}:${GITHUB_TOKEN}" \
"https://api.github.com/repos/${org}/${repo}/pulls?head=${repo}:${branch}" | jq '.[0].url') "https://api.github.com/repos/${org}/${repo}/pulls?head=${repo}:${branch}" | jq '.[0].url')
if [[ "${prLink}" != "null" ]]; then if [[ "${prLink}" != "null" ]]; then
echo "Pull request already opened for branch '${branch}': ${prLink}" echo "Pull request already opened for branch '${branch}': ${prLink}"