From 29f62e977906148b534427d209d2f0209a3f1479 Mon Sep 17 00:00:00 2001 From: William Pursell Date: Sat, 29 Nov 2025 07:30:19 -0700 Subject: [PATCH 1/3] Add workflow to auto-rebase single-commit PRs Enable auto-merge in the repo with: gh repo edit --enable-auto-merge Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Type: github Type: infra --- .github/workflows/auto-rebase-merge.yml | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/auto-rebase-merge.yml diff --git a/.github/workflows/auto-rebase-merge.yml b/.github/workflows/auto-rebase-merge.yml new file mode 100644 index 00000000..af8ab71a --- /dev/null +++ b/.github/workflows/auto-rebase-merge.yml @@ -0,0 +1,27 @@ +name: Auto-rebase merge single-commit PRs + +on: + pull_request: + types: + - opened + - synchronize + +permissions: + contents: write + pull-requests: write + +jobs: + auto-merge: + runs-on: ubuntu-latest + steps: + - name: Check and enable auto-merge with rebase + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + run: | + commit_count=$(gh pr view "$PR_NUMBER" --json commits -q '.commits | length') + + if test "$commit_count" -eq 1; then + gh pr merge "$PR_NUMBER" --rebase --auto + echo "Enabled auto-merge with rebase for single-commit PR" + fi From c1758952a2027c6eef848a9a04c128ae3bf73f4f Mon Sep 17 00:00:00 2001 From: William Pursell Date: Sat, 29 Nov 2025 07:33:24 -0700 Subject: [PATCH 2/3] Use inline list syntax for types Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Type: github Type: infra --- .github/workflows/auto-rebase-merge.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/auto-rebase-merge.yml b/.github/workflows/auto-rebase-merge.yml index af8ab71a..936f2a59 100644 --- a/.github/workflows/auto-rebase-merge.yml +++ b/.github/workflows/auto-rebase-merge.yml @@ -2,9 +2,7 @@ name: Auto-rebase merge single-commit PRs on: pull_request: - types: - - opened - - synchronize + types: [opened, synchronize] permissions: contents: write From f962bc4c80ed3142f5ca51498af42f3aa79d1eb2 Mon Sep 17 00:00:00 2001 From: William Pursell Date: Sat, 29 Nov 2025 07:41:06 -0700 Subject: [PATCH 3/3] Add GH_REPO so gh can find the repository CI generates the following error: fatal: not a git repository (or any of the parent directories): .git Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Type: github Type: infra Type: .github --- .github/workflows/auto-rebase-merge.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/auto-rebase-merge.yml b/.github/workflows/auto-rebase-merge.yml index 936f2a59..32dcc402 100644 --- a/.github/workflows/auto-rebase-merge.yml +++ b/.github/workflows/auto-rebase-merge.yml @@ -15,6 +15,7 @@ jobs: - name: Check and enable auto-merge with rebase env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} PR_NUMBER: ${{ github.event.pull_request.number }} run: | commit_count=$(gh pr view "$PR_NUMBER" --json commits -q '.commits | length')