Skip to content

Commit 97f505c

Browse files
authored
Disable CI workflows on forked repositories (#1232)
* Restrict CI workflows to non-forked repositories 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. * Restrict Rust CLI build job to non-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.
1 parent b0d1c8e commit 97f505c

12 files changed

Lines changed: 20 additions & 0 deletions

.github/workflows/codegen-check.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ permissions:
2323
jobs:
2424
check:
2525
name: "Verify generated files are up-to-date"
26+
if: github.event.repository.fork == false
2627
runs-on: ubuntu-latest
2728
steps:
2829
- uses: actions/checkout@v4

.github/workflows/copilot-setup-steps.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ on:
1414
jobs:
1515
# The job MUST be called 'copilot-setup-steps' to be recognized by GitHub Copilot Agent
1616
copilot-setup-steps:
17+
if: github.event.repository.fork == false
1718
runs-on: ubuntu-latest
1819

1920
# Set minimal permissions for setup steps

.github/workflows/corrections-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ permissions:
1616
jobs:
1717
test:
1818
runs-on: ubuntu-latest
19+
if: github.event.repository.fork == false
1920
steps:
2021
- uses: actions/checkout@v4
2122
- uses: actions/setup-node@v4

.github/workflows/docs-validation.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ permissions:
2020
jobs:
2121
validate-typescript:
2222
name: "Validate TypeScript"
23+
if: github.event.repository.fork == false
2324
runs-on: ubuntu-latest
2425
steps:
2526
- uses: actions/checkout@v6
@@ -44,6 +45,7 @@ jobs:
4445

4546
validate-python:
4647
name: "Validate Python"
48+
if: github.event.repository.fork == false
4749
runs-on: ubuntu-latest
4850
steps:
4951
- uses: actions/checkout@v6
@@ -76,6 +78,7 @@ jobs:
7678

7779
validate-go:
7880
name: "Validate Go"
81+
if: github.event.repository.fork == false
7982
runs-on: ubuntu-latest
8083
steps:
8184
- uses: actions/checkout@v6
@@ -99,6 +102,7 @@ jobs:
99102

100103
validate-csharp:
101104
name: "Validate C#"
105+
if: github.event.repository.fork == false
102106
runs-on: ubuntu-latest
103107
steps:
104108
- uses: actions/checkout@v6

.github/workflows/dotnet-sdk-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ permissions:
2929
jobs:
3030
test:
3131
name: ".NET SDK Tests"
32+
if: github.event.repository.fork == false
3233
env:
3334
POWERSHELL_UPDATECHECK: Off
3435
strategy:

.github/workflows/go-sdk-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ permissions:
3030
jobs:
3131
test:
3232
name: "Go SDK Tests"
33+
if: github.event.repository.fork == false
3334
env:
3435
POWERSHELL_UPDATECHECK: Off
3536
strategy:

.github/workflows/nodejs-sdk-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ permissions:
3232
jobs:
3333
test:
3434
name: "Node.js SDK Tests"
35+
if: github.event.repository.fork == false
3536
env:
3637
POWERSHELL_UPDATECHECK: Off
3738
strategy:

.github/workflows/python-sdk-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ permissions:
3232
jobs:
3333
test:
3434
name: "Python SDK Tests"
35+
if: github.event.repository.fork == false
3536
env:
3637
POWERSHELL_UPDATECHECK: Off
3738
strategy:

.github/workflows/rust-publish-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ concurrency:
2424
jobs:
2525
publish:
2626
name: Publish to crates.io
27+
if: github.event.repository.fork == false
2728
runs-on: ubuntu-latest
2829
defaults:
2930
run:

.github/workflows/rust-sdk-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ permissions:
3030
jobs:
3131
test:
3232
name: "Rust SDK Tests"
33+
if: github.event.repository.fork == false
3334
env:
3435
POWERSHELL_UPDATECHECK: Off
3536
CARGO_TERM_COLOR: always
@@ -119,6 +120,7 @@ jobs:
119120
# bundled-CLI release pipeline) hit them downstream.
120121
bundle:
121122
name: "Rust SDK Bundled CLI Build"
123+
if: github.event.repository.fork == false
122124
env:
123125
CARGO_TERM_COLOR: always
124126
RUST_BACKTRACE: 1

0 commit comments

Comments
 (0)