Skip to content

Commit e6fa336

Browse files
committed
Store and restore dependency caches in init Action
1 parent ff625c8 commit e6fa336

File tree

6 files changed

+29
-2
lines changed

6 files changed

+29
-2
lines changed

lib/init-action-post.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action-post.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.

lib/init-action.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action.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.

src/init-action-post.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { getTemporaryDirectory, printDebugLogs } from "./actions-util";
1010
import { getGitHubVersion } from "./api-client";
1111
import { Config, getConfig } from "./config-utils";
1212
import * as debugArtifacts from "./debug-artifacts";
13+
import { uploadDependencyCaches } from "./dependency-caching";
1314
import { Features } from "./feature-flags";
1415
import * as initActionPostHelper from "./init-action-post-helper";
1516
import { getActionsLogger } from "./logging";
@@ -21,6 +22,7 @@ import {
2122
getActionsStatus,
2223
ActionName,
2324
getJobStatusDisplayName,
25+
JobStatus,
2426
} from "./status-report";
2527
import {
2628
checkDiskUsage,
@@ -110,6 +112,14 @@ async function runWrapper() {
110112
};
111113
await sendStatusReport(statusReport);
112114
}
115+
116+
// Store dependency cache(s) if the job was successful and dependency caching is enabled.
117+
if (
118+
jobStatus === JobStatus.SuccessStatus &&
119+
config.dependencyCachingEnabled
120+
) {
121+
await uploadDependencyCaches(config, logger);
122+
}
113123
}
114124

115125
void runWrapper();

src/init-action.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
import { getGitHubVersion } from "./api-client";
1717
import { CodeQL } from "./codeql";
1818
import * as configUtils from "./config-utils";
19+
import { downloadDependencyCaches } from "./dependency-caching";
1920
import {
2021
addDiagnostic,
2122
flushDiagnostics,
@@ -477,6 +478,11 @@ async function run() {
477478
}
478479
}
479480

481+
// Restore dependency cache(s), if they exist.
482+
if (config.dependencyCachingEnabled) {
483+
await downloadDependencyCaches(config.languages, logger);
484+
}
485+
480486
// For CLI versions <2.15.1, build tracing caused errors in MacOS ARM machines with
481487
// System Integrity Protection (SIP) disabled.
482488
if (

0 commit comments

Comments
 (0)