Skip to content

Commit 31742ae

Browse files
Copilotahpook
andauthored
fix: checkout PR branch in lint workflow instead of base branch
The lint.yml workflow uses pull_request_target trigger, which causes actions/checkout to check out the base branch (main) by default. This means rubocop runs against main's code, not the PR's changes. Add ref parameter to checkout the PR's head branch, with fallback to github.ref for workflow_dispatch and merge_group triggers. Co-authored-by: ahpook <56753+ahpook@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/explore/sessions/f08905db-e076-48a4-8c19-6b4acc2c537c
1 parent 188bdef commit 31742ae

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

.github/workflows/lint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v6.0.1
17+
with:
18+
ref: ${{ github.event.pull_request.head.ref || github.ref }}
1719

1820
- name: Setup Ruby
1921
uses: ruby/setup-ruby@v1.284.0

0 commit comments

Comments
 (0)