mirror of
https://github.com/actions/setup-node.git
synced 2025-07-25 16:08:25 +02:00
Merge branch 'main' into v-dmshib/v8-canary-factory
This commit is contained in:
commit
822a587e93
8 changed files with 115 additions and 41 deletions
|
@ -29,7 +29,7 @@ function writeRegistryToFile(
|
|||
scope = '@' + scope;
|
||||
}
|
||||
if (scope) {
|
||||
scope = scope.toLowerCase();
|
||||
scope = scope.toLowerCase() + ':';
|
||||
}
|
||||
|
||||
core.debug(`Setting auth in ${fileLocation}`);
|
||||
|
@ -38,7 +38,7 @@ function writeRegistryToFile(
|
|||
const curContents: string = fs.readFileSync(fileLocation, 'utf8');
|
||||
curContents.split(os.EOL).forEach((line: string) => {
|
||||
// Add current contents unless they are setting the registry
|
||||
if (!line.toLowerCase().startsWith('registry')) {
|
||||
if (!line.toLowerCase().startsWith(`${scope}registry`)) {
|
||||
newContents += line + os.EOL;
|
||||
}
|
||||
});
|
||||
|
@ -46,9 +46,7 @@ function writeRegistryToFile(
|
|||
// Remove http: or https: from front of registry.
|
||||
const authString: string =
|
||||
registryUrl.replace(/(^\w+:|^)/, '') + ':_authToken=${NODE_AUTH_TOKEN}';
|
||||
const registryString: string = scope
|
||||
? `${scope}:registry=${registryUrl}`
|
||||
: `registry=${registryUrl}`;
|
||||
const registryString: string = `${scope}registry=${registryUrl}`;
|
||||
const alwaysAuthString: string = `always-auth=${alwaysAuth}`;
|
||||
newContents += `${authString}${os.EOL}${registryString}${os.EOL}${alwaysAuthString}`;
|
||||
fs.writeFileSync(fileLocation, newContents);
|
||||
|
|
|
@ -105,19 +105,18 @@ export function isGhes(): boolean {
|
|||
}
|
||||
|
||||
export function isCacheFeatureAvailable(): boolean {
|
||||
if (!cache.isFeatureAvailable()) {
|
||||
if (isGhes()) {
|
||||
throw new Error(
|
||||
'Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.'
|
||||
);
|
||||
} else {
|
||||
core.warning(
|
||||
'The runner was not able to contact the cache service. Caching will be skipped'
|
||||
);
|
||||
}
|
||||
if (cache.isFeatureAvailable()) return true;
|
||||
|
||||
if (isGhes()) {
|
||||
core.warning(
|
||||
'Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.'
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
core.warning(
|
||||
'The runner was not able to contact the cache service. Caching will be skipped'
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue