Skip to content

Commit 66a3c24

Browse files
clee2000pytorchmergebot
authored andcommitted
Linter for no workflows on fork (pytorch#138849)
MInor, adds a linter that ensures that all jobs run on pull_request, schedule, push etc have a `if: github.repository_owner == 'pytorch'` or are dependent on a job that has that check There is also a setting in Github repos that can disable all workflows for that repo A lot of these are unnecessary because many jobs use reusable workflows that have that check. However, this is a one time change so I'm not that bothered Unfortunately I can't put this at the workflow level, which would make this better Lots of weird string parsing Pull Request resolved: pytorch#138849 Approved by: https://github.com/malfet
1 parent 01b055a commit 66a3c24

File tree

61 files changed

+334
-21
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+334
-21
lines changed

.github/templates/linux_binary_build_workflow.yml.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ env:
5353

5454
jobs:
5555
get-label-type:
56+
if: github.repository_owner == 'pytorch'
5657
name: get-label-type
5758
uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@main
5859
with:

.github/templates/windows_binary_build_workflow.yml.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ env:
5454

5555
jobs:
5656
get-label-type:
57+
if: github.repository_owner == 'pytorch'
5758
name: get-label-type
5859
uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@main
5960
with:

.github/workflows/auto_request_review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
jobs:
77
auto-request-review:
88
# Don't run on forked repos
9-
if: ${{ !github.event.pull_request.head.repo.fork }}
9+
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'pytorch' }}
1010
permissions:
1111
contents: read
1212
pull-requests: write

.github/workflows/build-android-binaries.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ concurrency:
2626

2727
jobs:
2828
android-build-test:
29+
if: github.repository_owner == 'pytorch'
2930
name: android-build-test
3031
uses: ./.github/workflows/_run_android_tests.yml
3132
with:

.github/workflows/build-conda-images.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ concurrency:
3131

3232
jobs:
3333
build-docker:
34+
if: github.repository_owner == 'pytorch'
3435
environment: ${{ (github.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/tags/v')) && 'docker-build' || '' }}
3536
runs-on: linux.9xlarge.ephemeral
3637
strategy:

.github/workflows/build-ios-binaries.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ concurrency:
3838
jobs:
3939
# TODO: Figure out how to migrate this job to M1 runner
4040
ios-build-test:
41+
if: github.repository_owner == 'pytorch'
4142
name: ios-build-test
4243
uses: ./.github/workflows/_ios-build-test.yml
4344
with:

.github/workflows/build-libtorch-images.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ concurrency:
3030

3131
jobs:
3232
get-label-type:
33+
if: github.repository_owner == 'pytorch'
3334
name: get-label-type
3435
uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@main
3536
with:

.github/workflows/build-manywheel-images.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ concurrency:
3434

3535
jobs:
3636
get-label-type:
37+
if: github.repository_owner == 'pytorch'
3738
name: get-label-type
3839
uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@main
3940
with:

.github/workflows/build-triton-wheel.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ concurrency:
2828

2929
jobs:
3030
get-label-type:
31+
if: github.repository_owner == 'pytorch'
3132
name: get-label-type
3233
uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@main
3334
with:

.github/workflows/check_mergeability_ghstack.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
jobs:
99
ghstack-mergeability-check:
10+
if: github.repository_owner == 'pytorch'
1011
runs-on: ubuntu-latest
1112
steps:
1213
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)