Skip to content

Commit

Permalink
fix(cache-nx): cache based on nx.json
Browse files Browse the repository at this point in the history
  • Loading branch information
EdieLemoine committed Jan 19, 2023
1 parent f5cef01 commit 6cc0848
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -515,22 +515,14 @@ Check if there are new commits in head that are not in base.

[Source](cache-nx/action.yml)

Save and restore the [Nx](https://nx.dev/) cache. Defaults to using `yarn.lock` for cache busting, use the `lockfile` input to override this.
Save and restore the [Nx](https://nx.dev/) cache.

1. Runs [actions/cache] and caches `./node_modules/.cache/nx`

##### Inputs

| Required | Name | Description | Example | Default |
|----------|------------|----------------------|---------------------|-------------|
| No | `lockfile` | Path to the lockfile | `package-lock.json` | `yarn.lock` |

##### Example

```yaml
- uses: myparcelnl/actions/cache-nx@v3
with:
lockfile: package-lock.json
```

[Codecov]: https://codecov.io
Expand Down
9 changes: 2 additions & 7 deletions cache-nx/action.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
name: 'Cache Nx 📦'
description: 'Cache Nx build results'

inputs:
lockfile:
description: 'Path to the lockfile'
default: '**/yarn.lock'

runs:
using: composite
steps:
- name: 'Cache Nx'
uses: actions/cache@v3
with:
path: node_modules/.cache/nx
key: ${{ runner.os }}-cache-nx-${{ hashFiles(inputs.lockfile) }}-${{ github.sha }}
key: ${{ runner.os }}-cache-nx-${{ hashFiles('nx.json') }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-cache-nx-${{ hashFiles(inputs.lockfile) }}-
${{ runner.os }}-cache-nx-${{ hashFiles('nx.json') }}-
${{ runner.os }}-cache-nx-

0 comments on commit 6cc0848

Please sign in to comment.