Skip to content

Commit 0d5de5a

Browse files
fix(scan-docker-image): grype DB should be downloaded at least daily (#329)
1 parent 7d7d644 commit 0d5de5a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

security-actions/scan-docker-image/action.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,21 @@ runs:
176176
env:
177177
grype: ${{ steps.grype.outputs.grype-path }}
178178

179+
- name: Get current date
180+
id: date
181+
shell: bash
182+
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
183+
179184
# Explicitly check for Grype DB in Git Cache
180185
- name: Check Git Cache for Grype DB
181186
id: grype_db_git_cache
182187
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
183188
with:
184189
# Grype cache files are stored in `~/.cache/grype/db` on Linux/macOS
185190
path: ~/.cache/grype/db
191+
# Given the DB should not be less than 5 days old let's refetch it at least once per day
186192
key: |
187-
cache_grype_db_v${{ steps.grype_metadata.outputs.grype_db_schema }}
193+
cache_grype_db_v${{ steps.grype_metadata.outputs.grype_db_schema }}_${{ steps.date.outputs.date }}
188194
189195
# Explicitly check for Grype DB in specified mirror
190196
- name: Parse Grype DB cache input

0 commit comments

Comments
 (0)