mirror of
https://github.com/actions/cache.git
synced 2025-07-30 02:30:15 +07:00
Stop warning when cache is not found (#40)
The cache not being found is a common situation so very visible warning is a little too much.
This commit is contained in:

committed by
Josh Gross

parent
57f889e86e
commit
ce4a52af49
@ -10,7 +10,7 @@ import { ArtifactCacheEntry } from "./contracts";
|
||||
|
||||
export async function getCacheEntry(
|
||||
keys: string[]
|
||||
): Promise<ArtifactCacheEntry> {
|
||||
): Promise<ArtifactCacheEntry | null> {
|
||||
const cacheUrl = getCacheUrl();
|
||||
const token = process.env["ACTIONS_RUNTIME_TOKEN"] || "";
|
||||
const bearerCredentialHandler = new BearerCredentialHandler(token);
|
||||
@ -28,9 +28,7 @@ export async function getCacheEntry(
|
||||
getRequestOptions()
|
||||
);
|
||||
if (response.statusCode === 204) {
|
||||
throw new Error(
|
||||
`Cache not found for input keys: ${JSON.stringify(keys)}.`
|
||||
);
|
||||
return null;
|
||||
}
|
||||
if (response.statusCode !== 200) {
|
||||
throw new Error(`Cache service responded with ${response.statusCode}`);
|
||||
|
Reference in New Issue
Block a user