Skip to content

Commit 23c9df3

Browse files
ashwin-antclaude
andauthored
ci: skip jobs requiring secrets when running from forks (anthropics#451)
## Summary - Add `if` conditions to skip e2e test jobs (`test-e2e`, `test-e2e-docker`, `test-examples`) when PRs come from forks - Add `if` condition to skip `claude-review` job for fork PRs - Prevents CI failures for external contributors since fork PRs don't have access to repo secrets like `ANTHROPIC_API_KEY` ## Test plan - [ ] Verify that unit tests still run for fork PRs (the `test` job has no condition) - [ ] Verify that e2e jobs are skipped for fork PRs - [ ] Verify that e2e jobs still run for PRs from the main repo - [ ] Verify that push to main still triggers all jobs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
1 parent 6b3044c commit 23c9df3

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

.github/workflows/claude-code-review.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@ on:
1212

1313
jobs:
1414
claude-review:
15-
# Optional: Filter by PR author
16-
# if: |
17-
# github.event.pull_request.user.login == 'external-contributor' ||
18-
# github.event.pull_request.user.login == 'new-developer' ||
19-
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20-
15+
# Skip on forks since they don't have access to secrets
16+
if: github.event.pull_request.head.repo.full_name == github.repository
2117
runs-on: ubuntu-latest
2218
permissions:
2319
contents: read

.github/workflows/test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ jobs:
3838
fail_ci_if_error: false
3939

4040
test-e2e:
41+
# Skip on forks since they don't have access to secrets
42+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
4143
runs-on: ${{ matrix.os }}
4244
needs: test # Run after unit tests pass
4345
strategy:
@@ -82,6 +84,8 @@ jobs:
8284
python -m pytest e2e-tests/ -v -m e2e
8385
8486
test-e2e-docker:
87+
# Skip on forks since they don't have access to secrets
88+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
8589
runs-on: ubuntu-latest
8690
needs: test # Run after unit tests pass
8791
# Run e2e tests in Docker to catch container-specific issues like #406
@@ -100,6 +104,8 @@ jobs:
100104
claude-sdk-test python -m pytest e2e-tests/ -v -m e2e
101105
102106
test-examples:
107+
# Skip on forks since they don't have access to secrets
108+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
103109
runs-on: ubuntu-latest
104110
needs: test-e2e # Run after e2e tests
105111
strategy:

0 commit comments

Comments
 (0)