Skip to content

Commit 2a7fe14

Browse files
committed
Use a type alias for a CI job
1 parent e7da0fa commit 2a7fe14

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919

2020
JOBS_YAML_PATH = Path(__file__).absolute().parent / "jobs.yml"
2121

22+
Job = Dict[str, Any]
2223

23-
def name_jobs(jobs: List[Dict], prefix: str) -> List[Dict]:
24+
25+
def name_jobs(jobs: List[Dict], prefix: str) -> List[Job]:
2426
"""
2527
Add a `name` attribute to each job, based on its image and the given `prefix`.
2628
"""
@@ -29,7 +31,7 @@ def name_jobs(jobs: List[Dict], prefix: str) -> List[Dict]:
2931
return jobs
3032

3133

32-
def add_base_env(jobs: List[Dict], environment: Dict[str, str]) -> List[Dict]:
34+
def add_base_env(jobs: List[Job], environment: Dict[str, str]) -> List[Job]:
3335
"""
3436
Prepends `environment` to the `env` attribute of each job.
3537
The `env` of each job has higher precedence than `environment`.
@@ -77,7 +79,7 @@ def find_job_type(ctx: GitHubCtx) -> Optional[JobType]:
7779
return None
7880

7981

80-
def calculate_jobs(job_type: JobType, job_data: Dict[str, Any]) -> List[Dict[str, Any]]:
82+
def calculate_jobs(job_type: JobType, job_data: Dict[str, Any]) -> List[Job]:
8183
if job_type == JobType.PR:
8284
return add_base_env(name_jobs(job_data["pr"], "PR"), job_data["envs"]["pr"])
8385
elif job_type == JobType.Try:

0 commit comments

Comments
 (0)