Skip to content

Commit 58501b8

Browse files
authored
bump-version should use --set-upstream for new branches (#83)
1 parent 759e98e commit 58501b8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

bump-version/action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ runs:
4444
shell: bash -eux {0}
4545
run: |
4646
if [ ${{ inputs.push_commit }} == "true" ]; then
47-
git push origin
47+
if git ls-remote --heads --exit-code origin "$(git symbolic-ref --short HEAD)" &>/dev/null; then
48+
git push origin
49+
else
50+
git push --set-upstream origin "$(git symbolic-ref --short HEAD)"
51+
fi
4852
echo "Pushed version bump: ${{ inputs.version }}" >> $GITHUB_STEP_SUMMARY
4953
else
5054
echo "Created version bump (no push): ${{ inputs.version }}" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)