Skip to content

Commit d94992c

Browse files
improve release.yml to ensure that the ref is up-to-date
1 parent c0e9ad0 commit d94992c

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

.github/workflows/release.yml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,33 @@ jobs:
5959
git checkout next
6060
git pull origin next
6161
62-
- name: Rebase next with main
63-
id: rebase
62+
- name: Check next branch is up-to-date with main
63+
id: branch-check
6464
run: |
65-
echo "Attempting to rebase next with main..."
66-
if git rebase origin/main; then
67-
echo "✅ Rebase successful"
68-
echo "rebase-success=true" >> $GITHUB_OUTPUT
69-
else
70-
echo "::error::❌ Rebase failed due to conflicts. Please resolve conflicts manually and try again."
71-
echo "Conflicts detected in the following files:"
72-
git status --porcelain | grep "^UU\|^AA\|^DD" || true
73-
echo "rebase-success=false" >> $GITHUB_OUTPUT
65+
echo "Checking if next branch is up-to-date with main..."
66+
67+
# Fetch latest main branch
68+
git fetch origin main
69+
70+
# Check if next is behind main
71+
BEHIND_COUNT=$(git rev-list --count next..origin/main)
72+
AHEAD_COUNT=$(git rev-list --count origin/main..next)
73+
74+
echo "Next branch is ${AHEAD_COUNT} commits ahead of main"
75+
echo "Next branch is ${BEHIND_COUNT} commits behind main"
76+
77+
if [ "$BEHIND_COUNT" -gt 0 ]; then
78+
echo "::error::❌ Next branch is ${BEHIND_COUNT} commits behind main. Please update next branch with the latest changes from main before creating a release."
79+
echo "To fix this, run: git checkout next && git merge main"
7480
exit 1
7581
fi
82+
83+
if [ "$AHEAD_COUNT" -eq 0 ]; then
84+
echo "::warning::⚠️ Next branch has no new commits compared to main. Are you sure you want to create a release?"
85+
fi
86+
87+
echo "✅ Next branch is up-to-date with main (${AHEAD_COUNT} commits ahead)"
88+
echo "branch-check-success=true" >> $GITHUB_OUTPUT
7689
7790
- name: Check if tag already exists
7891
run: |

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy