Skip to content

Commit bcda869

Browse files
committed
refactor(ci): enhance caching mechanism for SF CLI in static code validation workflow
1 parent 319260c commit bcda869

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

.github/workflows/ciStaticCodeValidation.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,25 @@ jobs:
3333
defaults:
3434
run:
3535
shell: bash
36+
env:
37+
SF_CLI_VERSION: ${{ vars.SF_CLI_VERSION || 'latest' }}
3638
steps:
39+
- name: Compute cache key (sf CLI)
40+
id: cachekey
41+
run: |
42+
if [ $SF_CLI_VERSION = "latest" ]; then
43+
# Rotate weekly; change to +%Y-%m for monthly
44+
echo "suffix=$(date +%Y-%V)" >> "$GITHUB_OUTPUT"
45+
else
46+
echo "suffix=static" >> "$GITHUB_OUTPUT"
47+
fi
48+
49+
- name: Cache npm (sf CLI)
50+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
51+
with:
52+
path: ~/.npm
53+
key: npm-${{ runner.os }}-sf-cli-$SF_CLI_VERSION-${{ steps.cachekey.outputs.suffix }}
54+
3755
- name: Install SF CLI
3856
uses: navikt/sf-platform/.github/actions/installSfCli@eb5b379e3b162280de8f5b9566cb41c25f0832f5
3957
with:

0 commit comments

Comments
 (0)