Skip to content

Commit b662e22

Browse files
committed
ci(github-actions): enable maven caching
1 parent e397ea3 commit b662e22

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

.github/workflows/maven-dependency-check.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,29 @@ jobs:
3636
with:
3737
distribution: temurin
3838
java-version: 25
39+
- name: Cache Maven dependencies
40+
# The build redirects the local repo to .m2/repository (see
41+
# -Dmaven.repo.local in MAVEN_OPTS), so cache it at the location the
42+
# build actually uses rather than setup-java's default ~/.m2/repository.
43+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
44+
with:
45+
path: .m2/repository
46+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
47+
restore-keys: |
48+
${{ runner.os }}-maven-
49+
- name: Cache dependency-check NVD database
50+
# Persist the NVD database (an H2 DB that dependency-check stores under
51+
# the local Maven repo) between runs. dependency-check updates it
52+
# incrementally, so restoring the previous copy turns the slow,
53+
# rate-limit-prone full NVD download into a quick delta update. The
54+
# unique per-run key always saves the freshly-updated DB; restore-keys
55+
# restores the most recent previous copy as the starting point.
56+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
57+
with:
58+
path: .m2/repository/org/owasp/dependency-check-data
59+
key: dependency-check-data-${{ github.run_id }}
60+
restore-keys: |
61+
dependency-check-data-
3962
- name: Dependency Check with Maven
4063
working-directory: xml
4164
env:

0 commit comments

Comments
 (0)