mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 09:14:58 +00:00
Refactor: Add determineCheckoutPath function for analyze action
This commit is contained in:
13
lib/entry-points.js
generated
13
lib/entry-points.js
generated
@@ -153801,6 +153801,9 @@ var CodeQLAnalysisError = class extends Error {
|
||||
message;
|
||||
error;
|
||||
};
|
||||
function determineCheckoutPath(action) {
|
||||
return action.actions.getRequiredInput("checkout_path");
|
||||
}
|
||||
async function setupPythonExtractor(logger) {
|
||||
const codeqlPython = process.env["CODEQL_PYTHON"];
|
||||
if (codeqlPython === void 0 || codeqlPython.length === 0) {
|
||||
@@ -156544,11 +156547,9 @@ async function runAutobuildIfLegacyGoWorkflow(config, logger) {
|
||||
);
|
||||
await runAutobuild(config, "go" /* go */, logger);
|
||||
}
|
||||
async function run({
|
||||
startedAt,
|
||||
logger,
|
||||
actions
|
||||
}) {
|
||||
async function run(action) {
|
||||
const startedAt = action.startedAt;
|
||||
const logger = action.logger;
|
||||
let uploadResults = void 0;
|
||||
let runStats = void 0;
|
||||
let config = void 0;
|
||||
@@ -156614,7 +156615,7 @@ async function run({
|
||||
getOptionalInput("ram") || process.env["CODEQL_RAM"],
|
||||
logger
|
||||
);
|
||||
const checkoutPath = actions.getRequiredInput("checkout_path");
|
||||
const checkoutPath = determineCheckoutPath(action);
|
||||
const diffRangePackDir = await setupDiffInformedQueryRun(
|
||||
logger,
|
||||
checkoutPath
|
||||
|
||||
@@ -10,6 +10,7 @@ import * as analyses from "./analyses";
|
||||
import {
|
||||
CodeQLAnalysisError,
|
||||
dbIsFinalized,
|
||||
determineCheckoutPath,
|
||||
QueriesStatusReport,
|
||||
runFinalize,
|
||||
runQueries,
|
||||
@@ -212,13 +213,11 @@ async function runAutobuildIfLegacyGoWorkflow(config: Config, logger: Logger) {
|
||||
await runAutobuild(config, BuiltInLanguage.go, logger);
|
||||
}
|
||||
|
||||
async function run({
|
||||
startedAt,
|
||||
logger,
|
||||
actions,
|
||||
}: ActionState<["Base", "Logger", "Actions"]>) {
|
||||
async function run(action: ActionState<["Base", "Logger", "Env", "Actions"]>) {
|
||||
// To capture errors appropriately, keep as much code within the try-catch as
|
||||
// possible, and only use safe functions outside.
|
||||
const startedAt = action.startedAt;
|
||||
const logger = action.logger;
|
||||
|
||||
let uploadResults:
|
||||
| Partial<Record<analyses.AnalysisKind, UploadResult>>
|
||||
@@ -311,7 +310,7 @@ async function run({
|
||||
logger,
|
||||
);
|
||||
|
||||
const checkoutPath = actions.getRequiredInput("checkout_path");
|
||||
const checkoutPath = determineCheckoutPath(action);
|
||||
|
||||
// Setup diff informed analysis if needed (based on whether init created the file)
|
||||
const diffRangePackDir = await setupDiffInformedQueryRun(
|
||||
|
||||
@@ -5,6 +5,7 @@ import { performance } from "perf_hooks";
|
||||
import * as io from "@actions/io";
|
||||
import * as yaml from "js-yaml";
|
||||
|
||||
import type { ActionState } from "./action-common";
|
||||
import { getTemporaryDirectory } from "./actions-util";
|
||||
import * as analyses from "./analyses";
|
||||
import { setupCppAutobuild } from "./autobuild";
|
||||
@@ -85,6 +86,17 @@ export interface QueriesStatusReport
|
||||
event_reports?: EventReport[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the path at which the repository being analysed is checked out at.
|
||||
* Returns the value of the required `checkout_path` input and validates that it
|
||||
* refers to the root of a repository.
|
||||
*
|
||||
* @param action The action state.
|
||||
*/
|
||||
export function determineCheckoutPath(action: ActionState<["Actions"]>) {
|
||||
return action.actions.getRequiredInput("checkout_path");
|
||||
}
|
||||
|
||||
async function setupPythonExtractor(logger: Logger) {
|
||||
const codeqlPython = process.env["CODEQL_PYTHON"];
|
||||
if (codeqlPython === undefined || codeqlPython.length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user