Sometimes our workflows require us to pull down a large number of dependencies. As the time to download these dependencies goes up we can think about caching them close to the Actions Runners to speed up your run time.
Take a look at actions/cache
for samples
Sample Maven Workflow:
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
Things to keep in mind about caching on GitHub.com
- 5GB Max cache size per repository
- 7 Day data retention
- Scoped to key and branch
- Avoid caching sensitive data