Skip to content

Commit 6e16a2c

Browse files
Update .github/workflows/release.yml
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent d51004b commit 6e16a2c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,13 @@ jobs:
142142
echo "Pushing changes to branch: $TARGET_BRANCH"
143143
144144
# Push the commits created by release:prepare
145-
git push origin "HEAD:${TARGET_BRANCH}"
145+
if ! git push --force-with-lease origin "HEAD:${TARGET_BRANCH}"; then
146+
echo "::error::Failed to push release commits to ${TARGET_BRANCH} due to branch divergence."
147+
echo "The remote branch may have new commits. Please resolve the conflict manually:"
148+
echo " 1. Fetch the latest changes: git fetch origin"
149+
echo " 2. Rebase or merge as needed, then push again with --force-with-lease."
150+
exit 1
151+
fi
146152
147153
# Push the tag created by release:prepare
148154
git push origin "$TAG_NAME"

0 commit comments

Comments
 (0)