Skip to content

Commit 006ad33

Browse files
committed
Use internal caching
1 parent 1c3ef1b commit 006ad33

3 files changed

Lines changed: 25 additions & 4 deletions

File tree

‎README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ The built jar is cached in `~/.cache/xml-model-validator`, and cache keys are
125125
scoped to the action commit (`github.action_sha`) so updates automatically
126126
invalidate stale binaries.
127127

128+
The action also caches Maven's local repository and wrapper directories under
129+
`~/.m2`, also keyed by `github.action_sha`, so dependency downloads are reused
130+
across runs of the same action revision.
131+
128132
If you want schema downloads to persist across jobs, cache
129133
`~/.cache/xml-model-validator` in your workflow. The action also restores and
130134
saves that cache itself with `actions/cache@v5`.

‎action.yml‎

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,22 @@ runs:
4444
restore-keys: |
4545
xml-model-validator-${{ runner.os }}-${{ github.action_sha }}-
4646
xml-model-validator-${{ runner.os }}-
47+
- name: Restore Maven Cache
48+
id: restore-maven-cache
49+
uses: actions/cache/restore@v5
50+
with:
51+
path: |
52+
~/.m2/repository
53+
~/.m2/wrapper
54+
key: xml-model-validator-maven-${{ runner.os }}-${{ github.action_sha }}
55+
restore-keys: |
56+
xml-model-validator-maven-${{ runner.os }}-${{ github.action_sha }}-
57+
xml-model-validator-maven-${{ runner.os }}-
4758
- name: Set Up Java
4859
uses: actions/setup-java@v5
4960
with:
5061
distribution: temurin
5162
java-version: "25"
52-
cache: maven
53-
cache-dependency-path: |
54-
${{ github.action_path }}/pom.xml
55-
${{ github.action_path }}/.mvn/wrapper/maven-wrapper.properties
5663
- name: Validate XML
5764
shell: bash
5865
working-directory: ${{ github.action_path }}
@@ -77,3 +84,11 @@ runs:
7784
with:
7885
path: ~/.cache/xml-model-validator
7986
key: xml-model-validator-${{ runner.os }}-${{ github.action_sha }}
87+
- name: Save Maven Cache
88+
if: always() && steps.restore-maven-cache.outputs.cache-hit != 'true'
89+
uses: actions/cache/save@v5
90+
with:
91+
path: |
92+
~/.m2/repository
93+
~/.m2/wrapper
94+
key: xml-model-validator-maven-${{ runner.os }}-${{ github.action_sha }}

‎entrypoint.sh‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ JAR_CACHE_DIR="${XML_MODEL_VALIDATOR_CACHE_HOME}/jar"
99
JAR_PATH="${JAR_CACHE_DIR}/xml-model-validator.jar"
1010
CHANGED_FILE_LIST="${RUNNER_TEMP}/xml-model-validator-changed-files.txt"
1111

12+
mkdir -p "${HOME}/.m2/repository" "${HOME}/.m2/wrapper"
13+
1214
if [ ! -f "${JAR_PATH}" ]; then
1315
echo "XML Model Validator: building from source..." >&2
1416
mkdir -p "${JAR_CACHE_DIR}"

0 commit comments

Comments
 (0)