.github: Set rocm workflows to only run on PRs (#71567)

Summary:
Also adds a mechanism for all workflows to do this

Signed-off-by: Eli Uriegas <eliuriegasfb.com>

cc jeffdaily sunway513 jithunnair-amd ROCmSupport KyleCZH

Pull Request resolved: https://github.com/pytorch/pytorch/pull/71567

Reviewed By: malfet

Differential Revision: D33687713

Pulled By: seemethere

fbshipit-source-id: a3c7ef41ed04f9caa82c180961d2f4b7c24582dd
(cherry picked from commit eef2eafffd)
This commit is contained in:
Eli Uriegas 2022-01-20 11:03:50 -08:00 committed by PyTorch MergeBot
parent 53b3904115
commit add774ddbd
3 changed files with 3 additions and 5 deletions

View File

@ -198,6 +198,7 @@ class CIWorkflow:
fx2trt_test: bool = False
timeout_after: int = 240
xcode_version: str = ''
only_on_pr: bool = False
# The following variables will be set as environment variables,
# so it's easier for both shell and Python scripts to consume it if false is represented as the empty string.
@ -606,6 +607,7 @@ LINUX_WORKFLOWS = [
docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-bionic-rocm4.5-py3.7",
test_runner_type=LINUX_ROCM_TEST_RUNNER,
num_test_shards=2,
only_on_pr=True,
ciflow_config=CIFlowConfig(
labels=set([LABEL_CIFLOW_LINUX, LABEL_CIFLOW_ROCM]),
),

View File

@ -13,7 +13,7 @@ on:
{%- if is_scheduled %}
schedule:
- cron: !{{ is_scheduled }}
{%- else %}
{%- elif not only_on_pr %}
push:
branches:
- master

View File

@ -6,10 +6,6 @@ name: linux-bionic-rocm4.5-py3.7
on:
pull_request:
types: [opened, synchronize, reopened, unassigned]
push:
branches:
- master
- release/*
workflow_dispatch:
env: