Skip to content

Commit

Permalink
fix python script
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoIeni committed Dec 5, 2024
1 parent d0835dc commit efb9f71
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/ci/github-actions/calculate-job-matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,21 @@ def format_run_type(run_type: WorkflowRunType) -> str:
raise AssertionError()


# Add new function before main:
def substitute_github_vars(jobs: list) -> list:
"""Replace GitHub context variables with environment variables in job configs."""
for job in jobs:
if "os" in job:
job["os"] = job["os"].replace(
"${{ github.run_id }}",
os.environ["GITHUB_RUN_ID"]
).replace(
"${{ github.run_attempt }}",
os.environ["GITHUB_RUN_ATTEMPT"]
)
return jobs


if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)

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


if not jobs:
raise Exception("Scheduled job list is empty, this is an error")

Expand Down

0 comments on commit efb9f71

Please sign in to comment.