From 254b86038250f3119ac74e9c0b61793da9b6c6e0 Mon Sep 17 00:00:00 2001 From: Koudai Aono Date: Fri, 19 Dec 2025 23:53:57 +0000 Subject: [PATCH] fix: handle fork PRs in lint workflow --- .github/workflows/lint.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 98443d53b..d11444ea2 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -17,11 +17,19 @@ jobs: github.event.sender.login == 'ilovelinux')) runs-on: ubuntu-latest steps: + # Checkout for forks (no PAT available, auto-commit won't run anyway) - uses: actions/checkout@v4 + if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository + with: + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + # Checkout for same-repo PRs, pushes, and pull_request_target (PAT for auto-commit and workflow retrigger) + - uses: actions/checkout@v4 + if: github.event_name == 'push' || github.event_name == 'pull_request_target' || github.event.pull_request.head.repo.full_name == github.repository with: - token: ${{ secrets.PAT || github.token }} ref: ${{ github.event.pull_request.head.ref || github.ref }} repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + token: ${{ secrets.PAT }} - uses: astral-sh/setup-uv@v5 - uses: actions/setup-python@v5 with: