File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -151,6 +151,15 @@ if [ "$DRY_RUN" = true ]; then
151151 echo " ---"
152152 echo " "
153153
154+ # Check for unpushed commits in dry-run
155+ git fetch origin
156+ LOCAL_COMMITS=$( git log origin/main..HEAD --oneline 2> /dev/null || git log origin/master..HEAD --oneline 2> /dev/null || echo " " )
157+ if [ -n " $LOCAL_COMMITS " ]; then
158+ echo " Local commits that would be pushed:"
159+ echo " $LOCAL_COMMITS "
160+ echo " "
161+ fi
162+
154163 echo " 🚫 DRY RUN: No tag created, nothing pushed"
155164else
156165 # Check if tag already exists
@@ -159,6 +168,31 @@ else
159168 exit 1
160169 fi
161170
171+ # Fetch to check for unpushed commits
172+ echo " Checking for unpushed commits..."
173+ git fetch origin
174+
175+ # Determine the main branch name
176+ MAIN_BRANCH=" main"
177+ if ! git show-ref --verify --quiet refs/remotes/origin/main; then
178+ MAIN_BRANCH=" master"
179+ fi
180+
181+ # Check if there are local commits to push
182+ LOCAL_COMMITS=$( git log origin/$MAIN_BRANCH ..HEAD --oneline 2> /dev/null || echo " " )
183+ if [ -n " $LOCAL_COMMITS " ]; then
184+ echo " Pushing local commits first..."
185+ echo " Commits to push:"
186+ echo " $LOCAL_COMMITS "
187+ echo " "
188+ git push origin HEAD:$MAIN_BRANCH
189+ echo " ✓ Local commits pushed"
190+ echo " "
191+ else
192+ echo " No local commits to push"
193+ echo " "
194+ fi
195+
162196 # Create tag with message
163197 echo " Creating tag $TAG_NAME ..."
164198 if [ -z " $CHANGES " ]; then
You can’t perform that action at this time.
0 commit comments