Skip to content

Commit 24bf359

Browse files
committed
Rename JobType to WorkflowRunType
1 parent 686baf5 commit 24bf359

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/ci/github-actions/calculate-job-matrix.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def add_base_env(jobs: List[Job], environment: Dict[str, str]) -> List[Job]:
4444
return jobs
4545

4646

47-
class JobType(enum.Enum):
47+
class WorkflowRunType(enum.Enum):
4848
PR = enum.auto()
4949
Try = enum.auto()
5050
Auto = enum.auto()
@@ -57,9 +57,9 @@ class GitHubCtx:
5757
repository: str
5858

5959

60-
def find_job_type(ctx: GitHubCtx) -> Optional[JobType]:
60+
def find_run_type(ctx: GitHubCtx) -> Optional[WorkflowRunType]:
6161
if ctx.event_name == "pull_request":
62-
return JobType.PR
62+
return WorkflowRunType.PR
6363
elif ctx.event_name == "push":
6464
old_bors_try_build = (
6565
ctx.ref in ("refs/heads/try", "refs/heads/try-perf") and
@@ -72,20 +72,20 @@ def find_job_type(ctx: GitHubCtx) -> Optional[JobType]:
7272
try_build = old_bors_try_build or new_bors_try_build
7373

7474
if try_build:
75-
return JobType.Try
75+
return WorkflowRunType.Try
7676

7777
if ctx.ref == "refs/heads/auto" and ctx.repository == "rust-lang-ci/rust":
78-
return JobType.Auto
78+
return WorkflowRunType.Auto
7979

8080
return None
8181

8282

83-
def calculate_jobs(job_type: JobType, job_data: Dict[str, Any]) -> List[Job]:
84-
if job_type == JobType.PR:
83+
def calculate_jobs(run_type: WorkflowRunType, job_data: Dict[str, Any]) -> List[Job]:
84+
if run_type == WorkflowRunType.PR:
8585
return add_base_env(name_jobs(job_data["pr"], "PR"), job_data["envs"]["pr"])
86-
elif job_type == JobType.Try:
86+
elif run_type == WorkflowRunType.Try:
8787
return add_base_env(name_jobs(job_data["try"], "try"), job_data["envs"]["try"])
88-
elif job_type == JobType.Auto:
88+
elif run_type == WorkflowRunType.Auto:
8989
return add_base_env(name_jobs(job_data["auto"], "auto"), job_data["envs"]["auto"])
9090

9191
return []
@@ -114,15 +114,15 @@ def get_github_ctx() -> GitHubCtx:
114114

115115
github_ctx = get_github_ctx()
116116

117-
job_type = find_job_type(github_ctx)
118-
logging.info(f"Job type: {job_type}")
117+
run_type = find_run_type(github_ctx)
118+
logging.info(f"Job type: {run_type}")
119119

120120
with open(CI_DIR / "channel") as f:
121121
channel = f.read().strip()
122122

123123
jobs = []
124-
if job_type is not None:
125-
jobs = calculate_jobs(job_type, data)
124+
if run_type is not None:
125+
jobs = calculate_jobs(run_type, data)
126126
jobs = skip_jobs(jobs, channel)
127127

128128
logging.info(f"Output:\n{yaml.dump(jobs, indent=4)}")

0 commit comments

Comments
 (0)