From 03eb9b35551d60d27dc5c039b7c571043a14a47d Mon Sep 17 00:00:00 2001 From: LUIS NOVO Date: Tue, 13 Jan 2026 19:05:16 -0300 Subject: [PATCH] fix: prevent duplicate workflow runs for PRs Add conditional logic to ensure only one workflow runs per PR: - pull_request_target: Only for fork PRs (external contributors) - pull_request: Only for same-repo PRs (internal branches) This prevents both triggers from firing simultaneously and causing conflicts or duplicate reviews. --- .github/workflows/claude-code-review.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index e049561..eb0e4c1 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -14,11 +14,10 @@ on: jobs: claude-review: - # Optional: Filter by PR author - # if: | - # github.event.pull_request.user.login == 'external-contributor' || - # github.event.pull_request.user.login == 'new-developer' || - # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' + # Run for fork PRs (via pull_request_target) OR same-repo PRs (via pull_request), but not both + if: | + (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) || + (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) runs-on: ubuntu-latest permissions: