@@ -2,6 +2,7 @@ import * as fs from "fs";
2
2
import * as path from "path" ;
3
3
import { performance } from "perf_hooks" ;
4
4
5
+ import * as github from "@actions/github" ;
5
6
import * as io from "@actions/io" ;
6
7
import del from "del" ;
7
8
import * as yaml from "js-yaml" ;
@@ -256,25 +257,26 @@ async function finalizeDatabaseCreation(
256
257
/**
257
258
* Set up the diff-informed analysis feature.
258
259
*
259
- * @param baseRef The base branch name, used for calculating the diff range.
260
- * @param headLabel The label that uniquely identifies the head branch across
261
- * repositories, used for calculating the diff range.
262
- * @param codeql
263
- * @param logger
264
- * @param features
265
260
* @returns Absolute path to the directory containing the extension pack for
266
261
* the diff range information, or `undefined` if the feature is disabled.
267
262
*/
268
263
export async function setupDiffInformedQueryRun (
269
- baseRef : string ,
270
- headLabel : string ,
271
264
codeql : CodeQL ,
272
265
logger : Logger ,
273
266
features : FeatureEnablement ,
274
267
) : Promise < string | undefined > {
275
268
if ( ! ( await features . getValue ( Feature . DiffInformedQueries , codeql ) ) ) {
276
269
return undefined ;
277
270
}
271
+
272
+ const pull_request = github . context . payload . pull_request ;
273
+ if ( ! pull_request ) {
274
+ return undefined ;
275
+ }
276
+
277
+ const baseRef = pull_request . base . ref as string ;
278
+ const headLabel = pull_request . head . label as string ;
279
+
278
280
return await withGroupAsync (
279
281
"Generating diff range extension pack" ,
280
282
async ( ) => {
0 commit comments