Skip to content

Commit 2510e6a

Browse files
committed
fix: check upstream before running script
1 parent e5ed927 commit 2510e6a

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

ci/build/release-prep.sh

+11-12
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,17 @@ main() {
6868
exit
6969
fi
7070

71+
# Note: we need to set upstream as well or the gh pr create step will fail
72+
# See: https://github.com/cli/cli/issues/575
73+
CURRENT_BRANCH=$(git branch | grep '\*' | cut -d' ' -f2-)
74+
if [[ -z $(git config "branch.${CURRENT_BRANCH}.remote") ]]; then
75+
echo "Doesn't look like you've pushed this branch to remote"
76+
# Note: we need to set upstream as well or the gh pr create step will fail
77+
# See: https://github.com/cli/cli/issues/575
78+
echo "Please set the upstream and then run the script"
79+
exit 1
80+
fi
81+
7182
# credit to jakwuh for this solution
7283
# https://gist.github.com/DarrenN/8c6a5b969481725a4413#gistcomment-1971123
7384
CODE_SERVER_CURRENT_VERSION=$(node -pe "require('./package.json').version")
@@ -90,18 +101,6 @@ main() {
90101

91102
$CMD git commit -am "chore(release): bump version to $CODE_SERVER_VERSION_TO_UPDATE"
92103

93-
# Note: we need to set upstream as well or the gh pr create step will fail
94-
# See: https://github.com/cli/cli/issues/575
95-
CURRENT_BRANCH=$(git branch | grep '\*' | cut -d' ' -f2-)
96-
if [[ -z $(git config "branch.${CURRENT_BRANCH}.remote") ]]; then
97-
echo "Doesn't look like you've pushed this branch to remote"
98-
echo -e "Pushing now using: git push origin $CURRENT_BRANCH\n"
99-
# Note: we need to set upstream as well or the gh pr create step will fail
100-
# See: https://github.com/cli/cli/issues/575
101-
echo "Please set the upstream and re-run the script"
102-
exit 1
103-
fi
104-
105104
# This runs from the root so that's why we use this path vs. ../../
106105
RELEASE_TEMPLATE_STRING=$(cat ./.github/PULL_REQUEST_TEMPLATE/release_template.md)
107106

0 commit comments

Comments
 (0)