fix: accept change suggestions
This commit is contained in:
parent
0f40f1c9f1
commit
9703c805e0
|
@ -58542,8 +58542,8 @@ exports.run = run;
|
|||
const cachePackages = () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const state = core.getState(constants_1.State.CacheMatchedKey);
|
||||
const primaryKey = core.getState(constants_1.State.CachePrimaryKey);
|
||||
if (primaryKey === '') {
|
||||
core.info('Missing lock files, not saving cache.');
|
||||
if (!primaryKey) {
|
||||
core.info('Primary key was not generated, not saving cache.');
|
||||
return;
|
||||
}
|
||||
const { 'global-packages': cachePath } = yield (0, cache_utils_1.getNuGetFolderPath)();
|
||||
|
@ -58687,9 +58687,9 @@ function isGhes() {
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.Outputs = exports.State = exports.cliCommand = exports.lockFilePattern = void 0;
|
||||
/** NuGet lock file glob pattern */
|
||||
exports.lockFilePattern = '**/packages.lock.json';
|
||||
exports.Outputs = exports.State = exports.cliCommand = exports.lockFilePatterns = void 0;
|
||||
/** NuGet lock file patterns */
|
||||
exports.lockFilePatterns = ['packages.lock.json'];
|
||||
/**
|
||||
* .NET CLI command to list local NuGet resources.
|
||||
* @see https://docs.microsoft.com/dotnet/core/tools/dotnet-nuget-locals
|
||||
|
|
|
@ -70946,13 +70946,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.restoreCache = void 0;
|
||||
const promises_1 = __nccwpck_require__(3977);
|
||||
const node_path_1 = __nccwpck_require__(9411);
|
||||
const cache = __importStar(__nccwpck_require__(7799));
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const glob = __importStar(__nccwpck_require__(8090));
|
||||
const cache_utils_1 = __nccwpck_require__(1678);
|
||||
const constants_1 = __nccwpck_require__(9042);
|
||||
const restoreCache = (cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const fileHash = yield glob.hashFiles(cacheDependencyPath || constants_1.lockFilePattern);
|
||||
const lockFilePath = cacheDependencyPath || (yield findLockFile());
|
||||
const fileHash = yield glob.hashFiles(lockFilePath);
|
||||
if (!fileHash) {
|
||||
throw new Error('Some specified paths were not resolved, unable to cache dependencies.');
|
||||
}
|
||||
|
@ -70971,6 +70974,15 @@ const restoreCache = (cacheDependencyPath) => __awaiter(void 0, void 0, void 0,
|
|||
core.info(`Cache restored from key: ${cacheKey}`);
|
||||
});
|
||||
exports.restoreCache = restoreCache;
|
||||
const findLockFile = () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const workspace = process.env.GITHUB_WORKSPACE;
|
||||
const rootContent = yield (0, promises_1.readdir)(workspace);
|
||||
const lockFile = constants_1.lockFilePatterns.find(item => rootContent.includes(item));
|
||||
if (!lockFile) {
|
||||
throw new Error(`Dependencies lock file is not found in ${workspace}. Supported file patterns: ${constants_1.lockFilePatterns.toString()}`);
|
||||
}
|
||||
return (0, node_path_1.join)(workspace, lockFile);
|
||||
});
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
@ -71097,9 +71109,9 @@ function isGhes() {
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.Outputs = exports.State = exports.cliCommand = exports.lockFilePattern = void 0;
|
||||
/** NuGet lock file glob pattern */
|
||||
exports.lockFilePattern = '**/packages.lock.json';
|
||||
exports.Outputs = exports.State = exports.cliCommand = exports.lockFilePatterns = void 0;
|
||||
/** NuGet lock file patterns */
|
||||
exports.lockFilePatterns = ['packages.lock.json'];
|
||||
/**
|
||||
* .NET CLI command to list local NuGet resources.
|
||||
* @see https://docs.microsoft.com/dotnet/core/tools/dotnet-nuget-locals
|
||||
|
@ -71493,9 +71505,6 @@ function run() {
|
|||
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
||||
yield (0, cache_restore_1.restoreCache)(cacheDependencyPath);
|
||||
}
|
||||
else {
|
||||
core.setOutput(constants_1.Outputs.CacheHit, false);
|
||||
}
|
||||
const matchersPath = path_1.default.join(__dirname, '../..', '.github');
|
||||
core.info(`##[add-matcher]${path_1.default.join(matchersPath, 'csc.json')}`);
|
||||
}
|
||||
|
@ -71626,6 +71635,22 @@ module.exports = require("net");
|
|||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3977:
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("node:fs/promises");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9411:
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("node:path");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2037:
|
||||
/***/ ((module) => {
|
||||
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
import {readdir} from 'node:fs/promises';
|
||||
import {join} from 'node:path';
|
||||
import * as cache from '@actions/cache';
|
||||
import * as core from '@actions/core';
|
||||
import * as glob from '@actions/glob';
|
||||
|
||||
import {getNuGetFolderPath} from './cache-utils';
|
||||
import {lockFilePattern, State, Outputs} from './constants';
|
||||
import {lockFilePatterns, State, Outputs} from './constants';
|
||||
|
||||
export const restoreCache = async (cacheDependencyPath?: string) => {
|
||||
const fileHash = await glob.hashFiles(cacheDependencyPath || lockFilePattern);
|
||||
const lockFilePath = cacheDependencyPath || (await findLockFile());
|
||||
const fileHash = await glob.hashFiles(lockFilePath);
|
||||
if (!fileHash) {
|
||||
throw new Error(
|
||||
'Some specified paths were not resolved, unable to cache dependencies.'
|
||||
|
@ -31,3 +34,17 @@ export const restoreCache = async (cacheDependencyPath?: string) => {
|
|||
core.saveState(State.CacheMatchedKey, cacheKey);
|
||||
core.info(`Cache restored from key: ${cacheKey}`);
|
||||
};
|
||||
|
||||
const findLockFile = async () => {
|
||||
const workspace = process.env.GITHUB_WORKSPACE!;
|
||||
const rootContent = await readdir(workspace);
|
||||
|
||||
const lockFile = lockFilePatterns.find(item => rootContent.includes(item));
|
||||
if (!lockFile) {
|
||||
throw new Error(
|
||||
`Dependencies lock file is not found in ${workspace}. Supported file patterns: ${lockFilePatterns.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
return join(workspace, lockFile);
|
||||
};
|
||||
|
|
|
@ -26,8 +26,8 @@ const cachePackages = async () => {
|
|||
const state = core.getState(State.CacheMatchedKey);
|
||||
const primaryKey = core.getState(State.CachePrimaryKey);
|
||||
|
||||
if (primaryKey === '') {
|
||||
core.info('Missing lock files, not saving cache.');
|
||||
if (!primaryKey) {
|
||||
core.info('Primary key was not generated, not saving cache.');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/** NuGet lock file glob pattern */
|
||||
export const lockFilePattern = '**/packages.lock.json';
|
||||
/** NuGet lock file patterns */
|
||||
export const lockFilePatterns = ['packages.lock.json'];
|
||||
|
||||
/**
|
||||
* .NET CLI command to list local NuGet resources.
|
||||
|
|
|
@ -98,8 +98,6 @@ export async function run() {
|
|||
if (core.getBooleanInput('cache') && isCacheFeatureAvailable()) {
|
||||
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
||||
await restoreCache(cacheDependencyPath);
|
||||
} else {
|
||||
core.setOutput(Outputs.CacheHit, false);
|
||||
}
|
||||
|
||||
const matchersPath = path.join(__dirname, '../..', '.github');
|
||||
|
|
Loading…
Reference in New Issue