Skip to content

Commit cf258f2

Browse files
authored
Merge pull request #5094 from github/kenyonj/fix-lint-fork-checkout
Fix lint workflow failing on fork PRs
2 parents f5604b9 + 1cc71e4 commit cf258f2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

.github/workflows/lint.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v6.0.2
1717
with:
18-
ref: ${{ github.event.pull_request.head.ref || github.ref }}
18+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
19+
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
1920

2021
- name: Setup Ruby
2122
uses: ruby/setup-ruby@v1.299.0
@@ -38,8 +39,11 @@ jobs:
3839
fi
3940
4041
- name: Commit and push changes
41-
if: env.changes == 'true'
42+
if: env.changes == 'true' && github.event.pull_request.head.repo.full_name == github.repository
43+
env:
44+
HEAD_REF: ${{ github.event.pull_request.head.ref }}
4245
run: |
46+
git checkout -b "$HEAD_REF"
4347
git add .
4448
git commit -m "chore: auto-corrected with RuboCop"
45-
git push
49+
git push origin "$HEAD_REF"

0 commit comments

Comments
 (0)