mirror of
https://github.com/julia-actions/cache.git
synced 2026-02-12 01:16:54 +08:00
URL encode any invalid key characters (#93)
* URL encode any invalid key characters * Test we handle invalid chars * Job matrices must match * Empty commit * Empty commit
This commit is contained in:
2
.github/workflows/CI.yml
vendored
2
.github/workflows/CI.yml
vendored
@@ -39,6 +39,7 @@ jobs:
|
||||
dep:
|
||||
- name: pandoc_jll
|
||||
version: "3"
|
||||
invalid-chars: "," # Use invalid characters in job matrix to ensure we escape them
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- windows-latest
|
||||
@@ -90,6 +91,7 @@ jobs:
|
||||
dep:
|
||||
- name: pandoc_jll
|
||||
version: "3"
|
||||
invalid-chars: "," # Use invalid characters in job matrix to ensure we escape them
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- windows-latest
|
||||
|
||||
@@ -95,6 +95,9 @@ runs:
|
||||
matrix_key=$(echo "$MATRIX_JSON" | jq 'paths(type != "object") as $p | ($p | join("-")) + "=" + (getpath($p) | tostring)' | jq -rs 'join(";") | . + ";"')
|
||||
fi
|
||||
restore_key="${{ inputs.cache-name }};os=${{ runner.os }};${matrix_key}"
|
||||
# URL encode any restricted characters:
|
||||
# https://github.com/actions/toolkit/blob/5430c5d84832076372990c7c27f900878ff66dc9/packages/cache/src/cache.ts#L38-L43
|
||||
restore_key=$(sed 's/,/%2C/g' <<<"${restore_key}")
|
||||
key="${restore_key}run_id=${{ github.run_id }};run_attempt=${{ github.run_attempt }}"
|
||||
echo "restore-key=${restore_key}" >> $GITHUB_OUTPUT
|
||||
echo "key=${key}" >> $GITHUB_OUTPUT
|
||||
|
||||
Reference in New Issue
Block a user