Fix for Gitea

This commit is contained in:
rak
2025-03-18 21:06:18 +01:00
parent 799ee7c97e
commit 555aead9ed
3 changed files with 15 additions and 9 deletions

View File

@@ -96552,6 +96552,7 @@ const cache = __importStar(__nccwpck_require__(7799));
const core = __importStar(__nccwpck_require__(2186));
const glob = __importStar(__nccwpck_require__(8090));
const STATE_CACHE_PRIMARY_KEY = 'cache-primary-key';
const STATE_CACHE_HIT = 'cache-hit';
const CACHE_MATCHED_KEY = 'cache-matched-key';
const CACHE_KEY_PREFIX = 'setup-java';
const supportedPackageManager = [
@@ -96624,7 +96625,7 @@ function computeCacheKey(packageManager, cacheDependencyPath) {
if (!fileHash) {
throw new Error(`No file in ${process.cwd()} matched to [${pattern}], make sure you have checked out the target repository`);
}
return `${CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${process.arch}-${packageManager.id}-${fileHash}`;
return `${CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-ABC-${process.arch}-${packageManager.id}-${fileHash}`;
});
}
/**
@@ -96642,7 +96643,7 @@ function restore(id, cacheDependencyPath) {
const matchedKey = yield cache.restoreCache(packageManager.path, primaryKey);
if (matchedKey) {
core.saveState(CACHE_MATCHED_KEY, matchedKey);
core.setOutput('cache-hit', matchedKey === primaryKey);
core.setOutput('cache-hit', true);
core.info(`Cache restored from key: ${matchedKey}`);
}
else {
@@ -96662,11 +96663,12 @@ function save(id) {
const matchedKey = core.getState(CACHE_MATCHED_KEY);
// Inputs are re-evaluated before the post action, so we want the original key used for restore
const primaryKey = core.getState(STATE_CACHE_PRIMARY_KEY);
const cacheHit = core.getState(STATE_CACHE_HIT);
if (!primaryKey) {
core.warning('Error retrieving key from state.');
return;
}
else if (matchedKey === primaryKey) {
else if (matchedKey === primaryKey || cacheHit) {
// no change in target directories
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
return;

8
dist/setup/index.js vendored
View File

@@ -131801,6 +131801,7 @@ const cache = __importStar(__nccwpck_require__(27799));
const core = __importStar(__nccwpck_require__(42186));
const glob = __importStar(__nccwpck_require__(28090));
const STATE_CACHE_PRIMARY_KEY = 'cache-primary-key';
const STATE_CACHE_HIT = 'cache-hit';
const CACHE_MATCHED_KEY = 'cache-matched-key';
const CACHE_KEY_PREFIX = 'setup-java';
const supportedPackageManager = [
@@ -131873,7 +131874,7 @@ function computeCacheKey(packageManager, cacheDependencyPath) {
if (!fileHash) {
throw new Error(`No file in ${process.cwd()} matched to [${pattern}], make sure you have checked out the target repository`);
}
return `${CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${process.arch}-${packageManager.id}-${fileHash}`;
return `${CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-ABC-${process.arch}-${packageManager.id}-${fileHash}`;
});
}
/**
@@ -131891,7 +131892,7 @@ function restore(id, cacheDependencyPath) {
const matchedKey = yield cache.restoreCache(packageManager.path, primaryKey);
if (matchedKey) {
core.saveState(CACHE_MATCHED_KEY, matchedKey);
core.setOutput('cache-hit', matchedKey === primaryKey);
core.setOutput('cache-hit', true);
core.info(`Cache restored from key: ${matchedKey}`);
}
else {
@@ -131911,11 +131912,12 @@ function save(id) {
const matchedKey = core.getState(CACHE_MATCHED_KEY);
// Inputs are re-evaluated before the post action, so we want the original key used for restore
const primaryKey = core.getState(STATE_CACHE_PRIMARY_KEY);
const cacheHit = core.getState(STATE_CACHE_HIT);
if (!primaryKey) {
core.warning('Error retrieving key from state.');
return;
}
else if (matchedKey === primaryKey) {
else if (matchedKey === primaryKey || cacheHit) {
// no change in target directories
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
return;

View File

@@ -9,6 +9,7 @@ import * as core from '@actions/core';
import * as glob from '@actions/glob';
const STATE_CACHE_PRIMARY_KEY = 'cache-primary-key';
const STATE_CACHE_HIT = 'cache-hit';
const CACHE_MATCHED_KEY = 'cache-matched-key';
const CACHE_KEY_PREFIX = 'setup-java';
@@ -98,7 +99,7 @@ async function computeCacheKey(
`No file in ${process.cwd()} matched to [${pattern}], make sure you have checked out the target repository`
);
}
return `${CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${process.arch}-${packageManager.id}-${fileHash}`;
return `${CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-ABC-${process.arch}-${packageManager.id}-${fileHash}`;
}
/**
@@ -116,7 +117,7 @@ export async function restore(id: string, cacheDependencyPath: string) {
const matchedKey = await cache.restoreCache(packageManager.path, primaryKey);
if (matchedKey) {
core.saveState(CACHE_MATCHED_KEY, matchedKey);
core.setOutput('cache-hit', matchedKey === primaryKey);
core.setOutput('cache-hit', true);
core.info(`Cache restored from key: ${matchedKey}`);
} else {
core.setOutput('cache-hit', false);
@@ -134,11 +135,12 @@ export async function save(id: string) {
// Inputs are re-evaluated before the post action, so we want the original key used for restore
const primaryKey = core.getState(STATE_CACHE_PRIMARY_KEY);
const cacheHit = core.getState(STATE_CACHE_HIT);
if (!primaryKey) {
core.warning('Error retrieving key from state.');
return;
} else if (matchedKey === primaryKey) {
} else if (matchedKey === primaryKey || cacheHit) {
// no change in target directories
core.info(
`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`