Disable CI workflows on forked repositories#1232
Open
IeuanWalker wants to merge 2 commits intogithub:mainfrom
Open
Disable CI workflows on forked repositories#1232IeuanWalker wants to merge 2 commits intogithub:mainfrom
IeuanWalker wants to merge 2 commits intogithub:mainfrom
Conversation
Add if: github.event.repository.fork == false to all workflow jobs to ensure CI only runs in the main repository. This improves security and conserves resources by preventing workflow execution in forked repos.
Added a condition to the "Rust SDK Bundled CLI Build" job in rust-sdk-tests.yml to ensure it only runs when the workflow is triggered from the main repository, preventing execution on forked repositories.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds job-level fork guards to GitHub Actions workflows so CI jobs do not run in forked copies of the repository, reducing unnecessary runner usage while preserving CI behavior in the upstream repo.
Changes:
- Gate CI/test/build jobs with
if: github.event.repository.fork == falseacross multiple workflows. - Apply the same fork gating to scenario build verification, docs validation, codegen checks, and release/publish workflows.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/verify-compiled.yml | Skip workflow recompilation verification job when running in a fork. |
| .github/workflows/scenario-builds.yml | Skip all scenario build jobs (TS/Python/Go/C#/Rust) when running in a fork. |
| .github/workflows/rust-sdk-tests.yml | Skip Rust SDK test and bundled-CLI build jobs when running in a fork. |
| .github/workflows/rust-publish-release.yml | Prevent crates.io publish job from running in forks. |
| .github/workflows/python-sdk-tests.yml | Skip Python SDK test job when running in a fork. |
| .github/workflows/nodejs-sdk-tests.yml | Skip Node.js SDK test job when running in a fork. |
| .github/workflows/go-sdk-tests.yml | Skip Go SDK test job when running in a fork. |
| .github/workflows/dotnet-sdk-tests.yml | Skip .NET SDK test job when running in a fork. |
| .github/workflows/docs-validation.yml | Skip docs validation jobs (TS/Python/Go/C#) when running in a fork. |
| .github/workflows/corrections-tests.yml | Skip corrections tests job when running in a fork. |
| .github/workflows/copilot-setup-steps.yml | Skip Copilot setup-steps job when running in a fork. |
| .github/workflows/codegen-check.yml | Skip codegen up-to-date check job when running in a fork. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When i forked and made some changes to the repo the other week, it automatically trigged github actions.
I don't think it's desirable/necessary to run the CI workflows on fork repositories as it's a lot of wasted action minutes.