@@ -288,16 +288,17 @@ function getPullRequestBranches(): PullRequestBranches | undefined {
288288}
289289
290290/**
291- * Set up the diff-informed analysis feature .
291+ * Check if the action should perform diff-informed analysis.
292292 *
293- * @returns Absolute path to the directory containing the extension pack for
294- * the diff range information, or `undefined` if the feature is disabled.
293+ * @returns If the action should perform diff-informed analysis, return
294+ * the base and head branches that should be used to compute the diff ranges.
295+ * Otherwise return `undefined`.
295296 */
296- export async function setupDiffInformedQueryRun (
297+ async function shouldPerformDiffInformedAnalysis (
297298 codeql : CodeQL ,
298- logger : Logger ,
299299 features : FeatureEnablement ,
300- ) : Promise < string | undefined > {
300+ logger : Logger ,
301+ ) : Promise < PullRequestBranches | undefined > {
301302 if ( ! ( await features . getValue ( Feature . DiffInformedQueries , codeql ) ) ) {
302303 return undefined ;
303304 }
@@ -308,6 +309,27 @@ export async function setupDiffInformedQueryRun(
308309 "Not performing diff-informed analysis " +
309310 "because we are not analyzing a pull request." ,
310311 ) ;
312+ }
313+ return branches ;
314+ }
315+
316+ /**
317+ * Set up the diff-informed analysis feature.
318+ *
319+ * @returns Absolute path to the directory containing the extension pack for
320+ * the diff range information, or `undefined` if the feature is disabled.
321+ */
322+ export async function setupDiffInformedQueryRun (
323+ codeql : CodeQL ,
324+ logger : Logger ,
325+ features : FeatureEnablement ,
326+ ) : Promise < string | undefined > {
327+ const branches = await shouldPerformDiffInformedAnalysis (
328+ codeql ,
329+ features ,
330+ logger ,
331+ ) ;
332+ if ( ! branches ) {
311333 return undefined ;
312334 }
313335
0 commit comments