Skip to content

Commit

Permalink
Fix CI cache version number (#392)
Browse files Browse the repository at this point in the history
The first weeks of the year have a leading zero (e.g. 09), so bash was interpreting it as octal-base. This is fixed with the '#10' prefix.

Removed the `cache-keys` id as it's not used in `fuzz.yml`.
  • Loading branch information
JoseSK999 authored Mar 3, 2025
1 parent 442b6b9 commit 0c15d67
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ jobs:

# Calculate cache keys
- name: Generate cache keys
id: cache-keys
run: |
YEAR=$(date +%Y)
BIWEEK=$(( ($(date +%U) + 1) / 2 ))
WEEK=$(date +%U)
# Use '10#' to always treat week number as base-10 (avoids octal when number has a leading zero)
BIWEEK=$(( (10#$WEEK + 1) / 2 ))
echo "CACHE_VERSION=${YEAR}(${BIWEEK})" >> $GITHUB_ENV
# Hash of all files that could affect the build
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ jobs:

# Bi-weekly numbers to refresh caches every two weeks, ensuring recent project changes are cached
- name: Set bi-weekly cache key
# Use '10#' to always treat week number as base-10 (avoids octal when number has a leading zero)
run: |
YEAR=$(date +%Y)
BIWEEK=$(( ($(date +%U) + 1) / 2 ))
WEEK=$(date +%U)
BIWEEK=$(( (10#$WEEK + 1) / 2 ))
echo "CACHE_VERSION=${YEAR}(${BIWEEK})" >> $GITHUB_ENV
shell: bash

Expand Down

0 comments on commit 0c15d67

Please sign in to comment.