mirror of
https://github.com/actions/setup-node.git
synced 2025-04-22 09:21:00 +00:00
add corepack option
This commit is contained in:
parent
c81d8ad96d
commit
394059ca5f
3 changed files with 201 additions and 193 deletions
|
@ -13,7 +13,10 @@ inputs:
|
|||
description: 'Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default.'
|
||||
check-latest:
|
||||
description: 'Set this option if you want the action to check for the latest available version that satisfies the version spec.'
|
||||
default: false
|
||||
default: 'false'
|
||||
corepack:
|
||||
description: 'Set this option if you want to install the core-pack.'
|
||||
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.'
|
||||
scope:
|
||||
|
|
11
src/main.ts
11
src/main.ts
|
@ -1,12 +1,12 @@
|
|||
import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
import * as installer from './installer';
|
||||
import fs from 'fs';
|
||||
import * as auth from './authutil';
|
||||
import os from 'os';
|
||||
import * as path from 'path';
|
||||
import * as auth from './authutil';
|
||||
import {restoreCache} from './cache-restore';
|
||||
import {isGhes, isCacheFeatureAvailable} from './cache-utils';
|
||||
import os = require('os');
|
||||
import * as installer from './installer';
|
||||
|
||||
export async function run() {
|
||||
try {
|
||||
|
@ -48,6 +48,11 @@ export async function run() {
|
|||
auth.configAuthentication(registryUrl, alwaysAuth);
|
||||
}
|
||||
|
||||
const enableCorepack = core.getInput('corepack');
|
||||
if (enableCorepack === 'true') {
|
||||
await exec.exec('corepack', ['enable']);
|
||||
}
|
||||
|
||||
if (cache && isCacheFeatureAvailable()) {
|
||||
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
||||
await restoreCache(cache, cacheDependencyPath);
|
||||
|
|
Loading…
Add table
Reference in a new issue