@@ -22,11 +22,36 @@ concurrency:
2222 group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
2323 cancel-in-progress : false
2424
25+ permissions :
26+ contents : read
27+
2528jobs :
29+ changed-files :
30+ name : Get changed files
31+ uses : ./.github/workflows/_get-changed-files.yml
32+ with :
33+ include-push-diff : true
34+
35+ run-decision :
36+ name : CI run decision
37+ uses : ./.github/workflows/_ci-run-decision.yml
38+
2639 export-model-cuda-windows-artifact :
2740 name : export-model-cuda-windows-artifact
28- # Skip this job if the pull request is from a fork (HuggingFace secrets are not available)
29- if : github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request'
41+ # Skip this job if the pull request is from a fork (HuggingFace secrets are not available).
42+ # Path-filtered on push: mirrors the workflow-level pull_request `paths:`
43+ # filter so push commits that don't touch CUDA-relevant paths skip
44+ # this job on non-sampled commits. See _ci-run-decision.yml for
45+ # the sampling policy.
46+ needs : [changed-files, run-decision]
47+ if : |
48+ (github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request') &&
49+ (
50+ contains(needs.changed-files.outputs.changed-files, 'backends/cuda') ||
51+ contains(needs.changed-files.outputs.changed-files, 'backends/aoti') ||
52+ contains(needs.changed-files.outputs.changed-files, '.github/workflows/cuda-windows.yml') ||
53+ needs.run-decision.outputs.is-full-run == 'true'
54+ )
3055 uses : pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
3156 permissions :
3257 id-token : write
@@ -114,7 +139,20 @@ jobs:
114139
115140 test-model-cuda-windows-e2e :
116141 name : test-model-cuda-windows-e2e
117- needs : export-model-cuda-windows-artifact
142+ # Same path filter as the export job above. Also explicitly gated
143+ # on the export job succeeding — when needs: jobs are *skipped*
144+ # (e.g. fork PR), GitHub still evaluates this if:, so without the
145+ # explicit success-check this job would run and then fail trying
146+ # to download an artifact that was never produced.
147+ needs : [changed-files, export-model-cuda-windows-artifact, run-decision]
148+ if : |
149+ needs.export-model-cuda-windows-artifact.result == 'success' &&
150+ (
151+ contains(needs.changed-files.outputs.changed-files, 'backends/cuda') ||
152+ contains(needs.changed-files.outputs.changed-files, 'backends/aoti') ||
153+ contains(needs.changed-files.outputs.changed-files, '.github/workflows/cuda-windows.yml') ||
154+ needs.run-decision.outputs.is-full-run == 'true'
155+ )
118156 uses : pytorch/test-infra/.github/workflows/windows_job.yml@main
119157 strategy :
120158 fail-fast : false
0 commit comments