Put TRAP cache cleanup behind a feature flag

This commit is contained in:
Henry Mercer 2024-05-22 19:14:50 +01:00
parent 4f2b1826e9
commit 6ccd5631d8
9 changed files with 35 additions and 6 deletions

8
lib/trap-caching.js generated
View file

@ -29,6 +29,7 @@ const path = __importStar(require("path"));
const actionsCache = __importStar(require("@actions/cache"));
const actionsUtil = __importStar(require("./actions-util"));
const apiClient = __importStar(require("./api-client"));
const feature_flags_1 = require("./feature-flags");
const util_1 = require("./util");
// This constant should be bumped if we make a breaking change
// to how the CodeQL Action stores or retrieves the TRAP cache,
@ -132,7 +133,12 @@ async function uploadTrapCaches(codeql, config, logger) {
return true;
}
exports.uploadTrapCaches = uploadTrapCaches;
async function cleanupTrapCaches(config, logger) {
async function cleanupTrapCaches(config, features, logger) {
if (!(await features.getValue(feature_flags_1.Feature.CleanupTrapCaches))) {
return {
trap_cache_cleanup_skipped_because: "feature disabled",
};
}
if (!(await actionsUtil.isAnalyzingDefaultBranch())) {
return {
trap_cache_cleanup_skipped_because: "not analyzing default branch",