Log key and ref for which we're retrieving caches
This commit is contained in:
parent
0b4214972e
commit
1bea17f717
6 changed files with 14 additions and 7 deletions
|
|
@ -4,6 +4,7 @@ import * as retry from "@octokit/plugin-retry";
|
|||
import consoleLogLevel from "console-log-level";
|
||||
|
||||
import { getActionVersion, getRequiredInput } from "./actions-util";
|
||||
import { Logger } from "./logging";
|
||||
import { parseRepositoryNwo } from "./repository";
|
||||
import {
|
||||
ConfigurationError,
|
||||
|
|
@ -204,11 +205,14 @@ export interface ActionsCacheItem {
|
|||
export async function listActionsCaches(
|
||||
key: string,
|
||||
ref: string,
|
||||
logger: Logger,
|
||||
): Promise<ActionsCacheItem[]> {
|
||||
const repositoryNwo = parseRepositoryNwo(
|
||||
getRequiredEnvParam("GITHUB_REPOSITORY"),
|
||||
);
|
||||
|
||||
logger.debug(`Retrieving Actions caches for key ${key} and ref ${ref}`);
|
||||
|
||||
const apiClient = getApiClient();
|
||||
return await apiClient.paginate(
|
||||
"GET /repos/{owner}/{repo}/actions/caches",
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ export async function cleanupTrapCaches(config: Config, logger: Logger) {
|
|||
try {
|
||||
for (const language of config.languages) {
|
||||
if (config.trapCaches[language]) {
|
||||
const matchingCaches = await getTrapCachesForLanguage(language);
|
||||
const matchingCaches = await getTrapCachesForLanguage(language, logger);
|
||||
for (const cache of matchingCaches) {
|
||||
logger.info(`Matched Actions cache ${JSON.stringify(cache)}`);
|
||||
}
|
||||
|
|
@ -180,10 +180,12 @@ export async function cleanupTrapCaches(config: Config, logger: Logger) {
|
|||
|
||||
async function getTrapCachesForLanguage(
|
||||
language: Language,
|
||||
logger: Logger,
|
||||
): Promise<apiClient.ActionsCacheItem[]> {
|
||||
const allCaches = await apiClient.listActionsCaches(
|
||||
CODEQL_TRAP_CACHE_PREFIX,
|
||||
await actionsUtil.getRef(),
|
||||
logger,
|
||||
);
|
||||
|
||||
return allCaches.filter((cache) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue