Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f43944d5d |
@@ -9,7 +9,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
## GitHub Actions Toolkit
|
## GitHub Actions Toolkit Test
|
||||||
|
|
||||||
The GitHub Actions ToolKit provides a set of packages to make creating actions easier.
|
The GitHub Actions ToolKit provides a set of packages to make creating actions easier.
|
||||||
|
|
||||||
|
|||||||
+1
-31
@@ -17,8 +17,7 @@ import {
|
|||||||
CommitCacheRequest,
|
CommitCacheRequest,
|
||||||
ReserveCacheRequest,
|
ReserveCacheRequest,
|
||||||
ReserveCacheResponse,
|
ReserveCacheResponse,
|
||||||
ITypedResponseWithError,
|
ITypedResponseWithError
|
||||||
ArtifactCacheList
|
|
||||||
} from './contracts'
|
} from './contracts'
|
||||||
import {downloadCacheHttpClient, downloadCacheStorageSDK} from './downloadUtils'
|
import {downloadCacheHttpClient, downloadCacheStorageSDK} from './downloadUtils'
|
||||||
import {
|
import {
|
||||||
@@ -105,10 +104,6 @@ export async function getCacheEntry(
|
|||||||
httpClient.getJson<ArtifactCacheEntry>(getCacheApiUrl(resource))
|
httpClient.getJson<ArtifactCacheEntry>(getCacheApiUrl(resource))
|
||||||
)
|
)
|
||||||
if (response.statusCode === 204) {
|
if (response.statusCode === 204) {
|
||||||
// List cache for primary key only if cache miss occurs
|
|
||||||
if (core.isDebug()) {
|
|
||||||
await printCachesListForDiagnostics(keys[0], httpClient, version)
|
|
||||||
}
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
if (!isSuccessStatusCode(response.statusCode)) {
|
if (!isSuccessStatusCode(response.statusCode)) {
|
||||||
@@ -127,31 +122,6 @@ export async function getCacheEntry(
|
|||||||
return cacheResult
|
return cacheResult
|
||||||
}
|
}
|
||||||
|
|
||||||
async function printCachesListForDiagnostics(
|
|
||||||
key: string,
|
|
||||||
httpClient: HttpClient,
|
|
||||||
version: string
|
|
||||||
): Promise<void> {
|
|
||||||
const resource = `caches?key=${encodeURIComponent(key)}`
|
|
||||||
const response = await retryTypedResponse('listCache', async () =>
|
|
||||||
httpClient.getJson<ArtifactCacheList>(getCacheApiUrl(resource))
|
|
||||||
)
|
|
||||||
if (response.statusCode === 200) {
|
|
||||||
const cacheListResult = response.result
|
|
||||||
const totalCount = cacheListResult?.totalCount
|
|
||||||
if (totalCount && totalCount > 0) {
|
|
||||||
core.debug(
|
|
||||||
`No matching cache found for cache key '${key}', version '${version} and scope ${process.env['GITHUB_REF']}. There exist one or more cache(s) with similar key but they have different version or scope. See more info on cache matching here: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key \nOther caches with similar key:`
|
|
||||||
)
|
|
||||||
for (const cacheEntry of cacheListResult?.artifactCaches || []) {
|
|
||||||
core.debug(
|
|
||||||
`Cache Key: ${cacheEntry?.cacheKey}, Cache Version: ${cacheEntry?.cacheVersion}, Cache Scope: ${cacheEntry?.scope}, Cache Created: ${cacheEntry?.creationTime}`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function downloadCache(
|
export async function downloadCache(
|
||||||
archiveLocation: string,
|
archiveLocation: string,
|
||||||
archivePath: string,
|
archivePath: string,
|
||||||
|
|||||||
-6
@@ -9,16 +9,10 @@ export interface ITypedResponseWithError<T> extends TypedResponse<T> {
|
|||||||
export interface ArtifactCacheEntry {
|
export interface ArtifactCacheEntry {
|
||||||
cacheKey?: string
|
cacheKey?: string
|
||||||
scope?: string
|
scope?: string
|
||||||
cacheVersion?: string
|
|
||||||
creationTime?: string
|
creationTime?: string
|
||||||
archiveLocation?: string
|
archiveLocation?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ArtifactCacheList {
|
|
||||||
totalCount: number
|
|
||||||
artifactCaches?: ArtifactCacheEntry[]
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CommitCacheRequest {
|
export interface CommitCacheRequest {
|
||||||
size: number
|
size: number
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user