From bc629738058f68315adf6a7d482de52396ee9b3a Mon Sep 17 00:00:00 2001 From: Gage Krumbach Date: Tue, 10 Mar 2026 16:44:24 -0500 Subject: [PATCH] fix: check out PR's feature branch instead of main The pr-fixer sessions now resolve the PR's head branch and pass it in the repos config so the runner clones the feature branch directly instead of starting on main. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/pr-fixer.yml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-fixer.yml b/.github/workflows/pr-fixer.yml index 8a5687ef4..b7859b624 100644 --- a/.github/workflows/pr-fixer.yml +++ b/.github/workflows/pr-fixer.yml @@ -67,6 +67,15 @@ jobs: echo "skip=false" >> $GITHUB_OUTPUT fi + - name: Get PR branch + if: steps.fork_check.outputs.skip != 'true' + id: pr_branch + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + BRANCH=$(gh pr view ${{ steps.pr.outputs.number }} --repo "${{ github.repository }}" --json headRefName --jq '.headRefName') + echo "branch=$BRANCH" >> $GITHUB_OUTPUT + - name: Fix PR if: steps.fork_check.outputs.skip != 'true' id: session @@ -81,7 +90,7 @@ jobs: comments (fix valid issues, respond to invalid ones), run lints and tests, and push the fixes. repos: >- - [{"url": "https://github.com/${{ github.repository }}", "branch": "main"}] + [{"url": "https://github.com/${{ github.repository }}", "branch": "${{ steps.pr_branch.outputs.branch }}"}] workflow: >- {"gitUrl": "https://github.com/ambient-code/workflows", "branch": "main", "path": "internal-workflows/pr-fixer"} model: claude-sonnet-4-5 @@ -177,6 +186,15 @@ jobs: echo "skip=false" >> $GITHUB_OUTPUT fi + - name: Get PR branch + if: steps.churn_check.outputs.skip != 'true' + id: pr_branch + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + BRANCH=$(gh pr view ${{ matrix.pr_number }} --repo "${{ github.repository }}" --json headRefName --jq '.headRefName') + echo "branch=$BRANCH" >> $GITHUB_OUTPUT + - name: Fix PR #${{ matrix.pr_number }} if: steps.churn_check.outputs.skip != 'true' id: session @@ -191,7 +209,7 @@ jobs: comments (fix valid issues, respond to invalid ones), run lints and tests, and push the fixes. repos: >- - [{"url": "https://github.com/${{ github.repository }}", "branch": "main"}] + [{"url": "https://github.com/${{ github.repository }}", "branch": "${{ steps.pr_branch.outputs.branch }}"}] workflow: >- {"gitUrl": "https://github.com/ambient-code/workflows", "branch": "main", "path": "internal-workflows/pr-fixer"} model: claude-sonnet-4-5