Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a99da03c77 | |||
| e0023baa89 | |||
| 17bd5c18e9 | |||
| 4b6dd2fbd0 | |||
| d6c6f72a70 | |||
| 819157bf87 | |||
| 86102e88e9 | |||
| e4c071ba19 | |||
| 9443e26349 | |||
| 5a0405df4e | |||
| 0e707aeabc | |||
| 7441dc5e59 | |||
| 1ddac5e02f | |||
| 55484166d8 | |||
| 7181b913f5 | |||
| 81cd5a5c2e | |||
| 4b348086a9 | |||
| 436cf8d6ea | |||
| e0aadb573c | |||
| 62a66a8ce9 | |||
| 0c58e4113e | |||
| 9366237c90 |
@@ -221,7 +221,7 @@ console.log(`We can even get context data, like the repo: ${context.repo.repo}`)
|
|||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
We welcome contributions. See [how to contribute](.github/CONTRIBUTING.md).
|
We welcome contributions. See [how to contribute](.github/CONTRIBUTING.md).
|
||||||
|
hi
|
||||||
## Code of Conduct
|
## Code of Conduct
|
||||||
|
|
||||||
See [our code of conduct](CODE_OF_CONDUCT.md).
|
See [our code of conduct](CODE_OF_CONDUCT.md).
|
||||||
|
|||||||
+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
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/io",
|
"name": "@actions/io",
|
||||||
"version": "1.1.2",
|
"version": "1.1.3",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@actions/io",
|
"name": "@actions/io",
|
||||||
"version": "1.1.2",
|
"version": "1.1.3",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/io",
|
"name": "@actions/io",
|
||||||
"version": "1.1.2",
|
"version": "1.1.3",
|
||||||
"description": "Actions io lib",
|
"description": "Actions io lib",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"github",
|
"github",
|
||||||
|
|||||||
+12
-3
@@ -4,7 +4,8 @@ import * as path from 'path'
|
|||||||
import {promisify} from 'util'
|
import {promisify} from 'util'
|
||||||
import * as ioUtil from './io-util'
|
import * as ioUtil from './io-util'
|
||||||
|
|
||||||
const exec = promisify(childProcess.exec)
|
// const exec = promisify(childProcess.exec)
|
||||||
|
// const fork = promisify(childProcess.fork)
|
||||||
const execFile = promisify(childProcess.execFile)
|
const execFile = promisify(childProcess.execFile)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -129,12 +130,20 @@ export async function rmRF(inputPath: string): Promise<void> {
|
|||||||
try {
|
try {
|
||||||
const cmdPath = ioUtil.getCmdPath()
|
const cmdPath = ioUtil.getCmdPath()
|
||||||
if (await ioUtil.isDirectory(inputPath, true)) {
|
if (await ioUtil.isDirectory(inputPath, true)) {
|
||||||
await exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, {
|
await execFile(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, {
|
||||||
env: {inputPath}
|
env: {inputPath}
|
||||||
|
}).catch(err => {
|
||||||
|
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||||
|
// other errors are valid
|
||||||
|
if (err.code !== 'ENOENT') throw err
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
await exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, {
|
await execFile(`${cmdPath} /s /c "del /f /a "%inputPath%""`, {
|
||||||
env: {inputPath}
|
env: {inputPath}
|
||||||
|
}).catch(err => {
|
||||||
|
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||||
|
// other errors are valid
|
||||||
|
if (err.code !== 'ENOENT') throw err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user