Skip to content

Commit

Permalink
Merge pull request #2 from twosigma/readme
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
allenli873 authored Dec 29, 2024
2 parents 041589a + 44bb13d commit ca4a0ed
Showing 1 changed file with 22 additions and 7 deletions.
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.

0 comments on commit ca4a0ed

Please sign in to comment.