Skip to content

Commit deac4cd

Browse files
committed
ci: switch GGUF model cache key to URL hash
Replaces the use of the ETag header with a SHA-256 hash of the GGUF model URL for cache key generation in the workflow. This improves reliability by avoiding dependency on remote server ETag support.
1 parent e6e0d18 commit deac4cd

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

.github/workflows/main.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ env:
1515
jobs:
1616
download-model:
1717
outputs:
18-
cache-key: gguf-${{ steps.meta.outputs.etag }}
18+
cache-key: gguf-${{ steps.meta.outputs.hash }}
1919
name: Download GGUF model
2020
runs-on: ubuntu-22.04
2121
steps:
22-
- name: Fetch GGUF metadata
22+
- name: Compute model URL hash
2323
id: meta
2424
run: |
25-
etag=$(curl -sI "${{ env.GGUF_MODEL_URL }}" | tr -d '\r' | awk 'tolower($1)=="etag:" {print $2}' | tr -d '"')
26-
if [ -z "$etag" ]; then
27-
echo "Failed to determine model ETag" >&2
28-
exit 1
25+
if command -v sha256sum >/dev/null 2>&1; then
26+
hash=$(echo -n "${{ env.GGUF_MODEL_URL }}" | sha256sum | cut -d' ' -f1)
27+
else
28+
hash=$(echo -n "${{ env.GGUF_MODEL_URL }}" | shasum -a 256 | cut -d' ' -f1)
2929
fi
30-
echo "etag=$etag" >> "$GITHUB_OUTPUT"
30+
echo "hash=$hash" >> "$GITHUB_OUTPUT"
3131
3232
- name: Prepare model directory
3333
run: mkdir -p "${{ env.GGUF_MODEL_DIR }}"
@@ -37,7 +37,7 @@ jobs:
3737
uses: actions/cache@v4
3838
with:
3939
path: ${{ env.GGUF_MODEL_DIR }}/${{ env.GGUF_MODEL_NAME }}
40-
key: gguf-${{ steps.meta.outputs.etag }}
40+
key: gguf-${{ steps.meta.outputs.hash }}
4141

4242
- name: Download GGUF model
4343
if: steps.cache.outputs.cache-hit != 'true'

0 commit comments

Comments
 (0)