Skip to content

fix: Skip Claude Code actions on fork PRs#182

Merged
rdmueller merged 1 commit intodocToolchain:mainfrom
raifdmueller:fix/github-actions-skip-forks
Jan 26, 2026
Merged

fix: Skip Claude Code actions on fork PRs#182
rdmueller merged 1 commit intodocToolchain:mainfrom
raifdmueller:fix/github-actions-skip-forks

Conversation

@raifdmueller
Copy link
Collaborator

Summary

Prevents Claude Code GitHub Actions from running on pull requests from forks, where they would fail due to missing ANTHROPIC_API_KEY secret.

Problem

When external contributors create PRs from forks:

  • Forks don't have access to repository secrets
  • Claude Code actions fail with authentication errors
  • Creates noise in the CI/CD pipeline

Changes

claude-code-review.yml

Added condition to skip entirely for fork PRs:

if: github.event.pull_request.head.repo.full_name == github.repository

claude.yml

Added fork checks for PR-related events:

  • pull_request_review_comment: Skip if from fork
  • pull_request_review: Skip if from fork
  • issue_comment: Allow (will fail gracefully if on fork PR, but we can't detect that easily)
  • issues: Allow (not fork-specific)

Behavior

Before:

  • Fork PRs → Claude actions run → Fail with authentication error

After:

  • Fork PRs → Claude actions skipped
  • Same-repo PRs → Claude actions run normally
  • Regular issues → Claude actions run normally

Testing

This will be automatically tested when:

  1. A fork PR is created (actions should be skipped)
  2. A same-repo PR is created (actions should run)

Notes

  • issue_comment events on fork PRs will still trigger but fail gracefully (acceptable trade-off, as we can't easily detect fork status for issue comments)
  • This follows GitHub Actions best practices for handling fork PRs with secrets

🤖 Generated with Claude Code

- claude-code-review.yml: Skip entirely for fork PRs (no secrets)
- claude.yml: Skip PR review events from forks
  * issue_comment: Allow (will fail gracefully if from fork)
  * pull_request_review_comment: Skip if fork
  * pull_request_review: Skip if fork
  * issues: Allow (not fork-specific)

Prevents workflow failures on fork PRs due to missing ANTHROPIC_API_KEY.

Condition: github.event.pull_request.head.repo.full_name == github.repository
@raifdmueller raifdmueller force-pushed the fix/github-actions-skip-forks branch from d2ecfe9 to 4690535 Compare January 26, 2026 12:20
@rdmueller rdmueller merged commit da31127 into docToolchain:main Jan 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants