File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ name: Auto Merge Develop to Main
33on :
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
88jobs :
99 merge :
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."
You can’t perform that action at this time.
0 commit comments