diff --git a/action.yml b/action.yml index c703307db..86f77b37a 100644 --- a/action.yml +++ b/action.yml @@ -15,7 +15,7 @@ inputs: description: 'Set this option if you want the action to check for the latest available version that satisfies the version spec.' default: 'false' corepack: - description: 'Automatically enables corepack' + description: 'Enable corepack. Setting this to anything but `true` will pass the value to `corepack enable`.' default: 'false' registry-url: description: 'Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN.' diff --git a/docs/advanced-usage.md b/docs/advanced-usage.md index 9548adb4c..708bb83d0 100644 --- a/docs/advanced-usage.md +++ b/docs/advanced-usage.md @@ -306,9 +306,9 @@ NOTE: As per https://github.com/actions/setup-node/issues/49 you cannot use `sec ### always-auth input The always-auth input sets `always-auth=true` in .npmrc file. With this option set [npm](https://docs.npmjs.com/cli/v6/using-npm/config#always-auth)/yarn sends the authentication credentials when making a request to the registries. -## Automatically enable `corepack` +## Enable and/or configure `corepack` -_Requires Node >=14.19.0 +_Requires Node >=14.19 or >=16.9_ `corepack` is a new experimental feature that automatically installs package managers as they are used. [Read more about it here](https://nodejs.org/docs/latest/api/corepack.html) @@ -327,9 +327,24 @@ e.g. ```json { "name": "example", - "packageManager": "pnpm@7.9.5", + "packageManager": "pnpm@7.13.2", // ... } ``` +Passing anything but `true` will pass the options to the `corepack enable` command: +```yaml +steps: +- uses: actions/checkout@v3 +- uses: actions/setup-node@v3 + with: + node-version: '14.x' + corepack: npm +``` + +will call + +```shell +corepack enable npm +```