Skip to content

Commit 86393ef

Browse files
committed
Compile dist/
1 parent efb2b60 commit 86393ef

File tree

4 files changed

+33
-11
lines changed

4 files changed

+33
-11
lines changed

dist/main/index.js

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103304,7 +103304,7 @@ async function setupBazel() {
103304103304

103305103305
await setupBazelisk()
103306103306
await restoreCache(config.bazeliskCache)
103307-
await restoreCache(config.diskCache)
103307+
await restoreDiskCache(config.diskCache)
103308103308
await restoreCache(config.repositoryCache)
103309103309
await restoreExternalCaches(config.externalCache)
103310103310

@@ -103421,7 +103421,7 @@ async function restoreExternalCaches(cacheConfig) {
103421103421
}
103422103422
}
103423103423

103424-
async function restoreCache(cacheConfig) {
103424+
async function restoreCacheImpl(cacheConfig, primaryKey, restoreKeys, cacheHit) {
103425103425
if (!cacheConfig.enabled) {
103426103426
return
103427103427
}
@@ -103430,23 +103430,20 @@ async function restoreCache(cacheConfig) {
103430103430
await index_setTimeout(delay, async function () {
103431103431
core.startGroup(`Restore cache for ${cacheConfig.name}`)
103432103432

103433-
const hash = await glob.hashFiles(cacheConfig.files.join('\n'))
103434103433
const name = cacheConfig.name
103435103434
const paths = cacheConfig.paths
103436-
const restoreKey = `${config.baseCacheKey}-${name}-`
103437-
const key = `${restoreKey}${hash}`
103438103435

103439-
core.debug(`Attempting to restore ${name} cache from ${key}`)
103436+
core.debug(`Attempting to restore ${name} cache from ${primaryKey}`)
103440103437

103441103438
const restoredKey = await cache.restoreCache(
103442-
paths, key, [restoreKey],
103439+
paths, primaryKey, restoreKeys,
103443103440
{ segmentTimeoutInMs: 300000 } // 5 minutes
103444103441
)
103445103442

103446103443
if (restoredKey) {
103447103444
core.info(`Successfully restored cache from ${restoredKey}`)
103448103445

103449-
if (restoredKey === key) {
103446+
if (cacheHit(restoredKey)) {
103450103447
core.saveState(`${name}-cache-hit`, 'true')
103451103448
}
103452103449
} else {
@@ -103457,6 +103454,30 @@ async function restoreCache(cacheConfig) {
103457103454
}())
103458103455
}
103459103456

103457+
async function restoreCache(cacheConfig) {
103458+
const hash = await glob.hashFiles(cacheConfig.files.join('\n'))
103459+
const restoreKey = `${config.baseCacheKey}-${cacheConfig.name}-`
103460+
const key = `${restoreKey}${hash}`
103461+
await restoreCacheImpl(
103462+
cacheConfig, key, [restoreKey],
103463+
restoredKey => restoredKey === key
103464+
)
103465+
}
103466+
103467+
async function restoreDiskCache(cacheConfig) {
103468+
const hash = await glob.hashFiles(cacheConfig.files.join('\n'))
103469+
103470+
// Since disk caches get updated on any change, each run has a unique key.
103471+
// Therefore it can only be restored by prefix match, rather than exact key match.
103472+
// When multiple prefix matches exist, the most recent is selected.
103473+
const restoreKey = `${config.baseCacheKey}-${cacheConfig.name}-`
103474+
const hashedRestoreKey = `${restoreKey}${hash}-`
103475+
await restoreCacheImpl(
103476+
cacheConfig, hashedRestoreKey, [hashedRestoreKey, restoreKey],
103477+
restoredKey => restoredKey.startsWith(hashedRestoreKey)
103478+
)
103479+
}
103480+
103460103481
run()
103461103482

103462103483
module.exports = __webpack_exports__;

dist/main/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/post/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102427,6 +102427,7 @@ const fs = __nccwpck_require__(9896)
102427102427
const path = __nccwpck_require__(6928)
102428102428
const cache = __nccwpck_require__(5116)
102429102429
const core = __nccwpck_require__(7484)
102430+
const github = __nccwpck_require__(3228)
102430102431
const glob = __nccwpck_require__(7206)
102431102432
const config = __nccwpck_require__(700)
102432102433
const gc = __nccwpck_require__(1724)
@@ -102505,7 +102506,7 @@ async function saveDiskCache(cacheConfig) {
102505102506
// We don't want to follow symlinks as it's extremely slow on macOS.
102506102507
{ followSymbolicLinks: false }
102507102508
)
102508-
const key = `${config.baseCacheKey}-${cacheConfig.name}-${hash}`
102509+
const key = `${config.baseCacheKey}-${cacheConfig.name}-${hash}-${github.context.runId}.${github.context.runAttempt}`
102509102510
core.debug(`Attempting to save ${paths} cache to ${key}`)
102510102511
await cache.saveCache(paths, key)
102511102512
core.info('Successfully saved cache')

dist/post/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)