Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #2

Merged
merged 1 commit into from
Dec 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
<p align="center">
<a href="https://github.com/actions/typescript-action/actions"><img alt="typescript-action status" src="https://github.com/actions/typescript-action/workflows/build-test/badge.svg"></a>
</p>
# maven-cache-cleaner

# cache-maven
![CI](https://github.com/twosigma/maven-cache-cleaner/actions/workflows/test.yml/badge.svg)
[![Check dist/](https://github.com/twosigma/maven-cache-cleaner/actions/workflows/check-dist.yml/badge.svg)](https://github.com/actions/typescript-action/actions/workflows/check-dist.yml)

This action properly caches your `~/.m2` repository to speed up your Maven builds. It also cleans up and only caches the dependencies in use to avoid infinite cache growth.
This action cleans up all Maven dependencies not used after calling the cache cleaner action. It is intended to be used after `actions/cache` to clean up the cache right before saving it. It is intended to prevent the cache from growing infinitely large with dependencies that are no longer used.

This action uses `atime` to determine if a dependency was used or not. If a dependency was not used, it will be deleted.

The action cleaning mechanism is inspired by this [StackOverflow answer](https://stackoverflow.com/a/29970448).

## Usage

Add these near the top of the workflow:

```yaml
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-build # Or any other key you want
uses: twosigma/maven-cache-cleaner@v1
```

Any files not accessed within the `~/.m2` directory after the `twosigma/maven-cache-cleaner` step will be deleted at the end of the action, before `actions/cache` saves the directory.

## Developer Guide

### Setup

```console
$ dawn setup
$ npm install
```

Expand All @@ -22,4 +38,3 @@ $ npm run all
```

Make sure to run the above before committing changes, or the GitHub action will fail.

Loading