Move PR branch detection into setupDiffInformedQueryRun()
This commit is contained in:
parent
c50c157cc3
commit
6adda79888
2 changed files with 15 additions and 19 deletions
|
|
@ -3,7 +3,6 @@ import path from "path";
|
|||
import { performance } from "perf_hooks";
|
||||
|
||||
import * as core from "@actions/core";
|
||||
import * as github from "@actions/github";
|
||||
|
||||
import * as actionsUtil from "./actions-util";
|
||||
import {
|
||||
|
|
@ -272,16 +271,11 @@ async function run() {
|
|||
logger,
|
||||
);
|
||||
|
||||
const pull_request = github.context.payload.pull_request;
|
||||
const diffRangePackDir =
|
||||
pull_request &&
|
||||
(await setupDiffInformedQueryRun(
|
||||
pull_request.base.ref as string,
|
||||
pull_request.head.label as string,
|
||||
codeql,
|
||||
logger,
|
||||
features,
|
||||
));
|
||||
const diffRangePackDir = await setupDiffInformedQueryRun(
|
||||
codeql,
|
||||
logger,
|
||||
features,
|
||||
);
|
||||
|
||||
await warnIfGoInstalledAfterInit(config, logger);
|
||||
await runAutobuildIfLegacyGoWorkflow(config, logger);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import * as fs from "fs";
|
|||
import * as path from "path";
|
||||
import { performance } from "perf_hooks";
|
||||
|
||||
import * as github from "@actions/github";
|
||||
import * as io from "@actions/io";
|
||||
import del from "del";
|
||||
import * as yaml from "js-yaml";
|
||||
|
|
@ -256,18 +257,10 @@ async function finalizeDatabaseCreation(
|
|||
/**
|
||||
* Set up the diff-informed analysis feature.
|
||||
*
|
||||
* @param baseRef The base branch name, used for calculating the diff range.
|
||||
* @param headLabel The label that uniquely identifies the head branch across
|
||||
* repositories, used for calculating the diff range.
|
||||
* @param codeql
|
||||
* @param logger
|
||||
* @param features
|
||||
* @returns Absolute path to the directory containing the extension pack for
|
||||
* the diff range information, or `undefined` if the feature is disabled.
|
||||
*/
|
||||
export async function setupDiffInformedQueryRun(
|
||||
baseRef: string,
|
||||
headLabel: string,
|
||||
codeql: CodeQL,
|
||||
logger: Logger,
|
||||
features: FeatureEnablement,
|
||||
|
|
@ -275,6 +268,15 @@ export async function setupDiffInformedQueryRun(
|
|||
if (!(await features.getValue(Feature.DiffInformedQueries, codeql))) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const pull_request = github.context.payload.pull_request;
|
||||
if (!pull_request) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const baseRef = pull_request.base.ref as string;
|
||||
const headLabel = pull_request.head.label as string;
|
||||
|
||||
return await withGroupAsync(
|
||||
"Generating diff range extension pack",
|
||||
async () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue