Skip to content

Commit d4dc338

Browse files
authored
Update auto-merge-to-main.yml
Signed-off-by: 1minds3t <1minds3t@proton.me>
1 parent 2c3a653 commit d4dc338

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

.github/workflows/auto-merge-to-main.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,23 @@ jobs:
233233
git pull origin main
234234
git fetch origin development
235235
236-
if [ -n "$COMMIT_COUNT" ] && [ "$COMMIT_COUNT" -gt 1 ]; then
237-
MESSAGE="Auto-merge: $COMMIT_COUNT clean commits from development ($SHORT_SHA)"
236+
# Fast-forward merge to preserve individual commit messages
237+
# This brings each commit from development into main with its original message
238+
if git merge $COMMIT_SHA --ff-only 2>/dev/null; then
239+
echo "✅ Fast-forward merge successful - all commits preserved"
238240
else
239-
MESSAGE="Auto-merge: development to main ($SHORT_SHA)"
241+
# If fast-forward fails (shouldn't happen but just in case), use rebase
242+
echo "Fast-forward not possible, attempting rebase merge..."
243+
git merge $COMMIT_SHA --no-ff -m "Merge development to main ($SHORT_SHA)" -m "$COMMIT_COUNT commits with clean CI"
240244
fi
241245
242-
git merge $COMMIT_SHA --no-ff -m "$MESSAGE" -m "All CI checks passed"
243246
git push origin main
244247
245-
echo "✅ Successfully merged to main"
248+
if [ -n "$COMMIT_COUNT" ] && [ "$COMMIT_COUNT" -gt 1 ]; then
249+
echo "✅ Successfully merged $COMMIT_COUNT commits to main (each with original message)"
250+
else
251+
echo "✅ Successfully merged 1 commit to main"
252+
fi
246253
env:
247254
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
248255

0 commit comments

Comments
 (0)