Skip to content

Commit e52e1e0

Browse files
authored
fix: handle fork PRs in lint workflow (#2706)
1 parent daa85a9 commit e52e1e0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

.github/workflows/lint.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,19 @@ jobs:
1717
github.event.sender.login == 'ilovelinux'))
1818
runs-on: ubuntu-latest
1919
steps:
20+
# Checkout for forks (no PAT available, auto-commit won't run anyway)
2021
- uses: actions/checkout@v4
22+
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
23+
with:
24+
ref: ${{ github.event.pull_request.head.ref }}
25+
repository: ${{ github.event.pull_request.head.repo.full_name }}
26+
# Checkout for same-repo PRs, pushes, and pull_request_target (PAT for auto-commit and workflow retrigger)
27+
- uses: actions/checkout@v4
28+
if: github.event_name == 'push' || github.event_name == 'pull_request_target' || github.event.pull_request.head.repo.full_name == github.repository
2129
with:
22-
token: ${{ secrets.PAT || github.token }}
2330
ref: ${{ github.event.pull_request.head.ref || github.ref }}
2431
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
32+
token: ${{ secrets.PAT }}
2533
- uses: astral-sh/setup-uv@v5
2634
- uses: actions/setup-python@v5
2735
with:

0 commit comments

Comments
 (0)