-
Notifications
You must be signed in to change notification settings - Fork 14
/
action.yml
27 lines (27 loc) · 899 Bytes
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
name: Maven Periodic Cache
description: Caches the Maven repository periodically by date.
inputs:
cache-period-days:
description: The maximum duration in days to keep the cache.
required: true
default: '30'
additional-paths:
description: Additional paths to cache (or not cache).
required: false
default: ''
runs:
using: composite
steps:
- name: Calculate the cache period
shell: bash
run: |
leveler="$(wc -c <<< "$GITHUB_REPOSITORY")"
echo "::set-output name=CACHE_PERIOD::$(date +%Y)-$(($(($leveler + $(date +%-j))) / ${{ inputs.cache-period-days }}))"
id: cache-interval
- name: Cache the local Maven repository
uses: actions/cache@v3
with:
path: |
~/.m2/repository
${{ inputs.additional-paths }}
key: ${{ runner.os }}-maven-${{ steps.cache-interval.outputs.CACHE_PERIOD }}