website url added ready to deploy #12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Auto Merge Develop to Main | |
| on: | |
| push: | |
| branches: | |
| - Develop # Trigger action on push to Develop | |
| jobs: | |
| merge: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| - name: Get last commit message on Develop | |
| id: last_commit | |
| run: | | |
| LAST_COMMIT_MSG=$(git log -1 --pretty=%B) | |
| echo "Last commit message: $LAST_COMMIT_MSG" | |
| echo "::set-output name=commit_message::$LAST_COMMIT_MSG" | |
| - name: Set up Git | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "[email protected]" | |
| - name: Checkout main branch | |
| run: | | |
| git fetch origin main | |
| git checkout main | |
| - name: Merge Develop into main (if commit message matches) | |
| run: | | |
| # Convert commit message to lowercase for case-insensitive comparison | |
| COMMIT_MSG_LOWER=$(echo "${{ steps.last_commit.outputs.commit_message }}" | tr '[:upper:]' '[:lower:]') | |
| if [[ "$COMMIT_MSG_LOWER" == *"ready to deploy"* ]]; then | |
| echo "Commit message matches, merging Develop into main." | |
| git merge origin/Develop --no-ff --allow-unrelated-histories -m "Merge Develop into main" | |
| # Attempt the merge and capture the result | |
| git merge origin/Develop --no-ff -m "Merge Develop into main" || { echo "Merge conflicts detected, skipping push."; exit 1; } | |
| git push origin main | |
| else | |
| echo "Commit message does not match, skipping merge." | |
| fi |