Skip to content

Commit efb9f71

Browse files
committed
fix python script
1 parent d0835dc commit efb9f71

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

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

+16
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,21 @@ def format_run_type(run_type: WorkflowRunType) -> str:
176176
raise AssertionError()
177177

178178

179+
# Add new function before main:
180+
def substitute_github_vars(jobs: list) -> list:
181+
"""Replace GitHub context variables with environment variables in job configs."""
182+
for job in jobs:
183+
if "os" in job:
184+
job["os"] = job["os"].replace(
185+
"${{ github.run_id }}",
186+
os.environ["GITHUB_RUN_ID"]
187+
).replace(
188+
"${{ github.run_attempt }}",
189+
os.environ["GITHUB_RUN_ATTEMPT"]
190+
)
191+
return jobs
192+
193+
179194
if __name__ == "__main__":
180195
logging.basicConfig(level=logging.INFO)
181196

@@ -195,6 +210,7 @@ def format_run_type(run_type: WorkflowRunType) -> str:
195210
jobs = calculate_jobs(run_type, data)
196211
jobs = skip_jobs(jobs, channel)
197212

213+
198214
if not jobs:
199215
raise Exception("Scheduled job list is empty, this is an error")
200216

0 commit comments

Comments
 (0)