diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml deleted file mode 100644 index 387d28c..0000000 --- a/.github/workflows/auto-merge.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Auto-merge on Approval - -on: - pull_request_review: - types: [submitted] - -jobs: - auto-merge: - # Only run when a review is approved and PR is not a draft - if: > - github.event.review.state == 'approved' && - github.event.pull_request.draft == false - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - - steps: - - name: Enable auto-merge - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_URL: ${{ github.event.pull_request.html_url }} - run: | - echo "Enabling auto-merge for PR: $PR_URL" - gh pr merge "$PR_URL" --auto --squash - echo "Auto-merge enabled. PR will merge when all required checks pass." diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb38887..4e6617b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -292,6 +292,29 @@ jobs: } timeout-minutes: 15 + # ============================================ + # Stage 4b: Auto-merge PR (PRs only, after e2e pass) + # ============================================ + auto-merge: + needs: e2e-tests-staging + if: > + always() && + needs.e2e-tests-staging.result == 'success' && + github.event_name == 'pull_request' + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - name: Enable auto-merge + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + run: | + echo "Enabling auto-merge for PR #$PR_NUMBER" + gh pr merge "$PR_NUMBER" --repo "${{ github.repository }}" --auto --squash + echo "Auto-merge enabled. PR will merge when all required checks pass." + # ============================================ # Stage 5: Deploy to Production (main only) # ============================================