Skip to content

Commit 21bee31

Browse files
authored
Update auto-merge.yml ready to deploy
1 parent 244f2a4 commit 21bee31

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.github/workflows/auto-merge.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Auto Merge Develop to Main
33
on:
44
push:
55
branches:
6-
- Develop # Trigger action on push to Develop (with a capital D)
6+
- Develop # Trigger action on push to Develop
77

88
jobs:
99
merge:
@@ -12,7 +12,7 @@ jobs:
1212
- name: Checkout code
1313
uses: actions/checkout@v2
1414

15-
- name: Get last commit message on develop
15+
- name: Get last commit message on Develop
1616
id: last_commit
1717
run: |
1818
LAST_COMMIT_MSG=$(git log -1 --pretty=%B)
@@ -29,14 +29,17 @@ jobs:
2929
git fetch origin main
3030
git checkout main
3131
32-
- name: Merge develop into main (if commit message matches)
32+
- name: Merge Develop into main (if commit message matches)
3333
run: |
3434
# Convert commit message to lowercase for case-insensitive comparison
3535
COMMIT_MSG_LOWER=$(echo "${{ steps.last_commit.outputs.commit_message }}" | tr '[:upper:]' '[:lower:]')
3636
3737
if [[ "$COMMIT_MSG_LOWER" == *"ready to deploy"* ]]; then
3838
echo "Commit message matches, merging Develop into main."
3939
git merge origin/Develop --no-ff --allow-unrelated-histories -m "Merge Develop into main"
40+
# Attempt the merge and capture the result
41+
git merge origin/Develop --no-ff -m "Merge Develop into main" || { echo "Merge conflicts detected, skipping push."; exit 1; }
42+
4043
git push origin main
4144
else
4245
echo "Commit message does not match, skipping merge."

0 commit comments

Comments
 (0)