diff --git a/.github/workflows/manual-pre-commit-merge.yml b/.github/workflows/manual-pre-commit-merge.yml index f647ebe..248c30d 100644 --- a/.github/workflows/manual-pre-commit-merge.yml +++ b/.github/workflows/manual-pre-commit-merge.yml @@ -98,11 +98,22 @@ jobs: body: 'Auto-approved pre-commit version update. Merging after checks pass.' }) - # Step 6: Automatically merge the PR - # This is the final step, only executed after all checks pass - # Squash all commits into a single commit on merge + # Step 6: Enable auto-merge on the PR so GitHub merges it once all checks pass - name: Auto-merge PR if: steps.check_changes.outputs.only_precommit == 'true' - uses: pascalgn/automerge-action@main env: - GITHUB_TOKEN: ${{ secrets.BOT_PAT }} + GH_TOKEN: ${{ secrets.BOT_PAT }} + run: | + gh --version + echo "PR: ${{ github.event.pull_request.number }}" + echo "Repo: ${{ github.repository }}" + gh pr view "${{ github.event.pull_request.number }}" \ + --repo "${{ github.repository }}" \ + --json "number,title,state,mergeable,mergeStateStatus" || { + echo "::error::Failed to view PR — check that BOT_PAT has the required scopes" + exit 1 + } + gh pr merge "${{ github.event.pull_request.number }}" \ + --squash \ + --auto \ + --repo "${{ github.repository }}"