Warn instead of fail for no-dependency-glob (#200)

Closes: #199
This commit is contained in:
Kevin Stillhammer 2024-12-20 11:32:52 +01:00 committed by GitHub
parent 2af22b5b2d
commit e3fb95a689
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 12 deletions

6
dist/save-cache/index.js generated vendored
View File

@ -91490,11 +91490,9 @@ function computeKeys(version) {
core.info(`Searching files using cache dependency glob: ${inputs_1.cacheDependencyGlob.split("\n").join(",")}`); core.info(`Searching files using cache dependency glob: ${inputs_1.cacheDependencyGlob.split("\n").join(",")}`);
cacheDependencyPathHash += yield (0, hash_files_1.hashFiles)(inputs_1.cacheDependencyGlob, true); cacheDependencyPathHash += yield (0, hash_files_1.hashFiles)(inputs_1.cacheDependencyGlob, true);
if (cacheDependencyPathHash === "-") { if (cacheDependencyPathHash === "-") {
throw new Error(`No file matched to [${inputs_1.cacheDependencyGlob.split("\n").join(",")}], make sure you have checked out the target repository and configured the cache-dependency-glob input correctly.`); core.warning(`No file matched to [${inputs_1.cacheDependencyGlob.split("\n").join(",")}]. The cache will never get invalidated. Make sure you have checked out the target repository and configured the cache-dependency-glob input correctly.`);
} }
} cacheDependencyPathHash = "-no-dependency-glob";
else {
cacheDependencyPathHash += "no-dependency-glob";
} }
const suffix = inputs_1.cacheSuffix ? `-${inputs_1.cacheSuffix}` : ""; const suffix = inputs_1.cacheSuffix ? `-${inputs_1.cacheSuffix}` : "";
const pythonVersion = yield getPythonVersion(); const pythonVersion = yield getPythonVersion();

6
dist/setup/index.js generated vendored
View File

@ -96573,11 +96573,9 @@ function computeKeys(version) {
core.info(`Searching files using cache dependency glob: ${inputs_1.cacheDependencyGlob.split("\n").join(",")}`); core.info(`Searching files using cache dependency glob: ${inputs_1.cacheDependencyGlob.split("\n").join(",")}`);
cacheDependencyPathHash += yield (0, hash_files_1.hashFiles)(inputs_1.cacheDependencyGlob, true); cacheDependencyPathHash += yield (0, hash_files_1.hashFiles)(inputs_1.cacheDependencyGlob, true);
if (cacheDependencyPathHash === "-") { if (cacheDependencyPathHash === "-") {
throw new Error(`No file matched to [${inputs_1.cacheDependencyGlob.split("\n").join(",")}], make sure you have checked out the target repository and configured the cache-dependency-glob input correctly.`); core.warning(`No file matched to [${inputs_1.cacheDependencyGlob.split("\n").join(",")}]. The cache will never get invalidated. Make sure you have checked out the target repository and configured the cache-dependency-glob input correctly.`);
} }
} cacheDependencyPathHash = "-no-dependency-glob";
else {
cacheDependencyPathHash += "no-dependency-glob";
} }
const suffix = inputs_1.cacheSuffix ? `-${inputs_1.cacheSuffix}` : ""; const suffix = inputs_1.cacheSuffix ? `-${inputs_1.cacheSuffix}` : "";
const pythonVersion = yield getPythonVersion(); const pythonVersion = yield getPythonVersion();

View File

@ -43,12 +43,11 @@ async function computeKeys(version: string): Promise<string> {
); );
cacheDependencyPathHash += await hashFiles(cacheDependencyGlob, true); cacheDependencyPathHash += await hashFiles(cacheDependencyGlob, true);
if (cacheDependencyPathHash === "-") { if (cacheDependencyPathHash === "-") {
throw new Error( core.warning(
`No file matched to [${cacheDependencyGlob.split("\n").join(",")}], make sure you have checked out the target repository and configured the cache-dependency-glob input correctly.`, `No file matched to [${cacheDependencyGlob.split("\n").join(",")}]. The cache will never get invalidated. Make sure you have checked out the target repository and configured the cache-dependency-glob input correctly.`,
); );
} }
} else { cacheDependencyPathHash = "-no-dependency-glob";
cacheDependencyPathHash += "no-dependency-glob";
} }
const suffix = cacheSuffix ? `-${cacheSuffix}` : ""; const suffix = cacheSuffix ? `-${cacheSuffix}` : "";
const pythonVersion = await getPythonVersion(); const pythonVersion = await getPythonVersion();