Skip to content

Commit 70602a2

Browse files
committed
fix: require environment approval for fork PRs in pull_request_target workflows
Fork PRs using pull_request_target bypass GitHub's standard approval gate while having access to repository secrets. This adds a conditional `cloud-tests` environment that requires reviewer approval only for fork PRs, while keeping internal PRs and push events unaffected.
1 parent fe028de commit 70602a2

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ env:
2525
jobs:
2626
run-tests:
2727
runs-on: ubuntu-latest
28+
environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'cloud-tests' || '' }}
2829
strategy:
2930
fail-fast: false
3031
matrix:

.github/workflows/fusion.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ env:
2828
jobs:
2929
run-tests:
3030
runs-on: ubuntu-latest
31+
environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'cloud-tests' || '' }}
3132
strategy:
3233
fail-fast: false
3334
matrix:

0 commit comments

Comments
 (0)