Skip to content

Commit 416ff0d

Browse files
authored
Merge pull request #4157 from github/mbg/refactor/checkout-path
Refactor how the `checkout_path` input is obtained
2 parents 6dd161b + 8a88af6 commit 416ff0d

8 files changed

Lines changed: 154 additions & 108 deletions

File tree

lib/entry-points.js

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

src/analyze-action.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,11 @@ async function runAutobuildIfLegacyGoWorkflow(config: Config, logger: Logger) {
212212
await runAutobuild(config, BuiltInLanguage.go, logger);
213213
}
214214

215-
async function run({ startedAt, logger }: ActionState<["Base", "Logger"]>) {
215+
async function run({
216+
startedAt,
217+
logger,
218+
actions,
219+
}: ActionState<["Base", "Logger", "Actions"]>) {
216220
// To capture errors appropriately, keep as much code within the try-catch as
217221
// possible, and only use safe functions outside.
218222

@@ -307,8 +311,13 @@ async function run({ startedAt, logger }: ActionState<["Base", "Logger"]>) {
307311
logger,
308312
);
309313

314+
const checkoutPath = actions.getRequiredInput("checkout_path");
315+
310316
// Setup diff informed analysis if needed (based on whether init created the file)
311-
const diffRangePackDir = await setupDiffInformedQueryRun(logger);
317+
const diffRangePackDir = await setupDiffInformedQueryRun(
318+
logger,
319+
checkoutPath,
320+
);
312321

313322
await warnIfGoInstalledAfterInit(config, logger);
314323
await runAutobuildIfLegacyGoWorkflow(config, logger);
@@ -354,7 +363,6 @@ async function run({ startedAt, logger }: ActionState<["Base", "Logger"]>) {
354363
actionsUtil.getOptionalInput("upload"),
355364
);
356365
if (runStats) {
357-
const checkoutPath = actionsUtil.getRequiredInput("checkout_path");
358366
const category = actionsUtil.getOptionalInput("category");
359367

360368
uploadResults = await postProcessAndUploadSarif(
@@ -388,18 +396,23 @@ async function run({ startedAt, logger }: ActionState<["Base", "Logger"]>) {
388396
// Possibly upload the overlay-base database to actions cache.
389397
// Note: Take care with the ordering of this call since databases may be cleaned up
390398
// at the `overlay` level.
391-
await cleanupAndUploadOverlayBaseDatabaseToCache(codeql, config, logger);
399+
await cleanupAndUploadOverlayBaseDatabaseToCache(
400+
codeql,
401+
config,
402+
logger,
403+
checkoutPath,
404+
);
392405

393406
// Possibly upload the database bundles for remote queries.
394407
// Note: Take care with the ordering of this call since databases may be cleaned up
395408
// at the `overlay` or `clear` level.
396409
databaseUploadResults = await cleanupAndUploadDatabases(
410+
{ logger, features },
397411
repositoryNwo,
398412
codeql,
399413
config,
400414
apiDetails,
401-
features,
402-
logger,
415+
checkoutPath,
403416
);
404417

405418
// Possibly upload the TRAP caches for later re-use

src/analyze.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { performance } from "perf_hooks";
55
import * as io from "@actions/io";
66
import * as yaml from "js-yaml";
77

8-
import { getTemporaryDirectory, getRequiredInput } from "./actions-util";
8+
import { getTemporaryDirectory } from "./actions-util";
99
import * as analyses from "./analyses";
1010
import { setupCppAutobuild } from "./autobuild";
1111
import { type CodeQL } from "./codeql";
@@ -233,6 +233,7 @@ async function finalizeDatabaseCreation(
233233
*/
234234
export async function setupDiffInformedQueryRun(
235235
logger: Logger,
236+
checkoutPath: string,
236237
): Promise<string | undefined> {
237238
return await withGroupAsync(
238239
"Generating diff range extension pack",
@@ -245,7 +246,6 @@ export async function setupDiffInformedQueryRun(
245246
return undefined;
246247
}
247248

248-
const checkoutPath = getRequiredInput("checkout_path");
249249
const packDir = writeDiffRangeDataExtensionPack(
250250
logger,
251251
diffRanges,

0 commit comments

Comments
 (0)