Skip to content

Commit 65d868f

Browse files
Update Documentation for Lockfile (#1454)
* update documentation for lockfile * Update adavance usage in README.md * Documentation update * Update lockfile documenation * fix coplilot suggestion
1 parent 395ad32 commit 65d868f

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ Since it will not be cached always, there is possibility of hitting rate limit w
148148

149149
### Checking in lockfiles
150150

151-
It's **always** recommended to commit the lockfile of your package manager for security and performance reasons. For more information consult the "Working with lockfiles" section of the [Advanced usage](docs/advanced-usage.md#working-with-lockfiles) guide.
151+
It's **strongly recommended** to commit the lockfile of your package manager for security and performance reasons. For more information consult the "Working with lockfiles" section of the [Advanced usage](docs/advanced-usage.md#working-with-lockfiles) guide.
152152

153153
## Caching global packages data
154154

@@ -249,6 +249,7 @@ If the runner is not able to access github.com, any Nodejs versions requested du
249249
- [Publishing to npmjs and GPR with npm](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-npm)
250250
- [Publishing to npmjs and GPR with yarn](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-yarn)
251251
- [Using private packages](docs/advanced-usage.md#use-private-packages)
252+
- [Using private mirror](docs/advanced-usage.md#use-private-mirror)
252253

253254
## Recommended permissions
254255

docs/advanced-usage.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Working with lockfiles
22

3-
All supported package managers recommend that you **always** commit the lockfile, although implementations vary doing so generally provides the following benefits:
3+
Most supported package managers recommend that you **always** commit the lockfile, although implementations vary doing so generally provides the following benefits:
44

55
- Enables faster installation for CI and production environments, due to being able to skip package resolution.
66
- Describes a single representation of a dependency tree such that teammates, deployments, and continuous integration are guaranteed to install exactly the same dependencies.
@@ -35,6 +35,25 @@ Ensure that `pnpm-lock.yaml` is always committed, when on CI pass `--frozen-lock
3535
- [Working with Git - Lockfiles](https://pnpm.io/git#lockfiles)
3636
- [Documentation of `--frozen-lockfile` option](https://pnpm.io/cli/install#--frozen-lockfile)
3737

38+
### Running without a lockfile
39+
40+
If you choose not to use a lockfile, you must ensure that **caching is disabled**. The `cache` feature relies on the lockfile to generate a unique key for the cache entry.
41+
42+
To run without a lockfile:
43+
1. Do not set the `cache` input.
44+
2. If your `package.json` contains a `packageManager` field set to npm (or devEngines.packageManager), automatic caching is enabled by default. Override this by setting `package-manager-cache: false`.
45+
46+
```yaml
47+
steps:
48+
- uses: actions/checkout@v6
49+
- uses: actions/setup-node@v6
50+
with:
51+
node-version: '24'
52+
package-manager-cache: false # Explicitly disable caching if you don't have a lockfile
53+
- run: npm install
54+
- run: npm test
55+
```
56+
3857
## Check latest version
3958
4059
The `check-latest` flag defaults to `false`. When set to `false`, the action will first check the local cache for a semver match. If unable to find a specific version in the cache, the action will attempt to download a version of Node.js. It will pull LTS versions from [node-versions releases](https://github.com/actions/node-versions/releases) and on miss or failure will fall back to the previous behavior of downloading directly from [node dist](https://nodejs.org/dist/). Use the default or set `check-latest` to `false` if you prefer stability and if you want to ensure a specific version of Node.js is always used.

0 commit comments

Comments
 (0)