diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index e299616..bec30ea 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -10,27 +10,31 @@ jobs: runs-on: ubuntu-latest steps: - # Step 1: Checkout the repository + # Step 1: Checkout the repository with all history - name: Checkout Repository uses: actions/checkout@v3 + with: + fetch-depth: 0 # Fetch full history to avoid merge conflicts - # Step 2: Configure Git (to authorize the merge commit) + # Step 2: Set up Git to authorize the merge commit - name: Set up Git run: | git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" - # Step 3: Fetch all branches and history + # Step 3: Fetch all branches - name: Fetch All Branches - run: git fetch --all + run: git fetch origin +refs/heads/*:refs/remotes/origin/* - # Step 4: Merge develop into staging + # Step 4: Check out the staging branch + - name: Check out Staging Branch + run: git checkout origin/staging -B staging # Ensure correct tracking + + # Step 5: Merge develop into staging - name: Merge Develop into Staging run: | - git checkout staging - git merge develop --no-ff --commit -m "Auto-merged develop into staging" + git merge origin/develop --no-ff --commit -m "Auto-merged develop into staging" - # Step 5: Push the changes to the staging branch + # Step 6: Push the merged changes to the staging branch - name: Push to Staging - run: | - git push origin staging + run: git push origin staging