Fix cache keys for Python version ranges (#937)

## Summary
- URL-encode the Python version component before adding it to the cache
key
- URL-encode the user-provided cache suffix for the same reason
- Add cache key tests for Python ranges, comma-containing suffixes, and
unchanged simple inputs

Fixes #914

Refs: pi-session 019f3164-85e7-7817-bffd-501d89b3a1fd

## Tests
- npm run all
This commit is contained in:
Kevin Stillhammer
2026-07-05 10:46:44 +02:00
committed by GitHub
parent 3cc3c11fdf
commit 17c398959b
4 changed files with 116 additions and 4 deletions

4
dist/setup/index.cjs generated vendored
View File

@@ -90621,8 +90621,8 @@ async function computeKeys(inputs, pythonVersion) {
if (cacheDependencyPathHash === "-") {
cacheDependencyPathHash = "-no-dependency-glob";
}
const suffix = inputs.cacheSuffix ? `-${inputs.cacheSuffix}` : "";
const version3 = pythonVersion ?? "unknown";
const suffix = inputs.cacheSuffix ? `-${encodeURIComponent(inputs.cacheSuffix)}` : "";
const version3 = encodeURIComponent(pythonVersion ?? "unknown");
const platform2 = await getPlatform();
const osNameVersion = getOSNameVersion();
const pruned = inputs.pruneCache ? "-pruned" : "";