Skip to content

Commit

Permalink
chore(workflows): update setup-uv cache-suffix to match Python version
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Sep 20, 2024
1 parent 652e88f commit 3162333
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions update-workflow
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ RUNS_UPDATE = {
"macos-latest": "macos-13",
"windows-latest": "windows-2022",
}
PYTHON_VERSION = "3.12"

yaml = ruamel.yaml.YAML()
yaml.indent = 2
Expand All @@ -37,14 +38,21 @@ for job_name in data["jobs"]:

# Use latest stable Python version for all workflows
for step in job["steps"]:
if step.get("uses", "").startswith("actions/setup-python@"):
uses = step.get("uses", "")
if uses.startswith("actions/setup-python@"):
try:
float(step["with"]["python-version"])
except (KeyError, ValueError):
continue
step["with"]["python-version"] = "3.12"
step["with"]["python-version"] = PYTHON_VERSION
modified = True
if uses.startswith("astral-sh/setup-uv@"):
try:
float(step["with"]["cache-suffix"])
except (KeyError, ValueError):
continue
step["with"]["cache-suffix"] = PYTHON_VERSION
modified = True
uses = step.get("uses", "")
if uses.startswith("actions/checkout@") and uses != "actions/checkout@v4":
step["uses"] = "actions/checkout@v4"
modified = True
Expand Down

0 comments on commit 3162333

Please sign in to comment.