Skip to content

Commit 4e3ae09

Browse files
authored
Merge pull request #5094 from github/kenyonj/fix-lint-fork-checkout
Fix lint workflow failing on fork PRs
2 parents f5604b9 + 49fa487 commit 4e3ae09

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

.github/workflows/lint.yml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,34 @@ on:
55
workflow_dispatch:
66
merge_group:
77

8-
permissions:
9-
contents: write
10-
checks: write
11-
128
jobs:
139
lint:
1410
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
steps:
14+
- uses: actions/checkout@v6.0.2
15+
with:
16+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
17+
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
18+
19+
- name: Setup Ruby
20+
uses: ruby/setup-ruby@v1.299.0
21+
with:
22+
bundler-cache: false
23+
24+
- name: Install dependencies
25+
run: bundle install
26+
27+
- name: Run RuboCop
28+
run: |
29+
bundle exec rubocop
30+
31+
autocorrect:
32+
if: github.event.pull_request.head.repo.full_name == github.repository
33+
runs-on: ubuntu-latest
34+
permissions:
35+
contents: write
1536
steps:
1637
- uses: actions/checkout@v6.0.2
1738
with:
@@ -27,7 +48,6 @@ jobs:
2748
bundle exec rubocop -A
2849
2950
- name: Check for changes
30-
id: changes
3151
run: |
3252
git config --global user.name "github-actions[bot]"
3353
git config --global user.email "github-actions[bot]@users.noreply.github.com"

0 commit comments

Comments
 (0)