Skip to content

Commit da79ab2

Browse files
committed
refactor: check for remote and exit if not present
1 parent acde797 commit da79ab2

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

ci/build/release-prep.sh

+9-2
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,17 @@ main() {
9393

9494
$CMD git add . && $CMD git commit -am "chore(release): bump version to $CODE_SERVER_VERSION_TO_UPDATE"
9595

96-
CURRENT_BRANCH=$(git branch | grep '\*' | cut -d' ' -f2-)
9796
# Note: we need to set upstream as well or the gh pr create step will fail
9897
# See: https://github.com/cli/cli/issues/575
99-
$CMD git push -u origin "$CURRENT_BRANCH
98+
CURRENT_BRANCH=$(git branch | grep '\*' | cut -d' ' -f2-)
99+
if [[ -z $(git config "branch.${CURRENT_BRANCH}.remote") ]]; then
100+
echo "Doesn't look like you've pushed this branch to remote"
101+
echo -e "Pushing now using: git push origin $CURRENT_BRANCH\n"
102+
# Note: we need to set upstream as well or the gh pr create step will fail
103+
# See: https://github.com/cli/cli/issues/575
104+
echo "Please set the upstream and re-run the script"
105+
exit 1
106+
fi
100107

101108
# This runs from the root so that's why we use this path vs. ../../
102109
RELEASE_TEMPLATE_STRING=$(cat ./.github/PULL_REQUEST_TEMPLATE/release_template.md)

ci/dev/update-vscode.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,13 @@ main() {
8282
# If we don't do this, the opening a draft PR step won't work
8383
# because it will stop and ask where you want to push the branch
8484
CURRENT_BRANCH=$(git branch | grep '\*' | cut -d' ' -f2-)
85-
if [[ -z $(git ls-remote --heads origin "$CURRENT_BRANCH") ]]; then
85+
if [[ -z $(git config "branch.${CURRENT_BRANCH}.remote") ]]; then
8686
echo "Doesn't look like you've pushed this branch to remote"
8787
echo -e "Pushing now using: git push origin $CURRENT_BRANCH\n"
8888
# Note: we need to set upstream as well or the gh pr create step will fail
8989
# See: https://github.com/cli/cli/issues/575
90-
git push -u origin "$CURRENT_BRANCH"
90+
echo "Please set the upstream and re-run the script"
91+
exit 1
9192
fi
9293

9394
echo "Going to try to update vscode for you..."

0 commit comments

Comments
 (0)