diff --git a/lib/analyze-action.js b/lib/analyze-action.js index 96ba73162..e6b0f7e15 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -110651,7 +110651,12 @@ async function setupDiffInformedQueryRun(branches, logger) { `Calculating diff ranges for ${branches.base}...${branches.head}` ); const diffRanges = await getPullRequestEditedDiffRanges(branches, logger); - const packDir = writeDiffRangeDataExtensionPack(logger, diffRanges); + const checkoutPath = getRequiredInput("checkout_path"); + const packDir = writeDiffRangeDataExtensionPack( + logger, + diffRanges, + checkoutPath + ); if (packDir === void 0) { logger.warning( "Cannot create diff range extension pack for diff-informed queries; reverting to performing full analysis." @@ -110684,7 +110689,7 @@ extensions: } return header + data; } -function writeDiffRangeDataExtensionPack(logger, ranges) { +function writeDiffRangeDataExtensionPack(logger, ranges, checkoutPath) { if (ranges === void 0) { return void 0; } @@ -110707,7 +110712,7 @@ dataExtensions: ); const extensionContents = diffRangeExtensionPackContents( ranges, - getRequiredInput("checkout_path") + checkoutPath ); const extensionFilePath = path12.join(diffRangeDir, "pr-diff-range.yml"); fs12.writeFileSync(extensionFilePath, extensionContents); diff --git a/src/analyze.ts b/src/analyze.ts index 5d10e96a6..8de1b98e8 100644 --- a/src/analyze.ts +++ b/src/analyze.ts @@ -247,7 +247,12 @@ export async function setupDiffInformedQueryRun( `Calculating diff ranges for ${branches.base}...${branches.head}`, ); const diffRanges = await getPullRequestEditedDiffRanges(branches, logger); - const packDir = writeDiffRangeDataExtensionPack(logger, diffRanges); + const checkoutPath = getRequiredInput("checkout_path"); + const packDir = writeDiffRangeDataExtensionPack( + logger, + diffRanges, + checkoutPath, + ); if (packDir === undefined) { logger.warning( "Cannot create diff range extension pack for diff-informed queries; " + @@ -310,12 +315,14 @@ extensions: * @param logger * @param ranges The file line ranges, as returned by * `getPullRequestEditedDiffRanges`. + * @param checkoutPath The path at which the repository was checked out. * @returns The absolute path of the directory containing the extension pack, or * `undefined` if no extension pack was created. */ function writeDiffRangeDataExtensionPack( logger: Logger, ranges: DiffThunkRange[] | undefined, + checkoutPath: string, ): string | undefined { if (ranges === undefined) { return undefined; @@ -353,7 +360,7 @@ dataExtensions: const extensionContents = diffRangeExtensionPackContents( ranges, - getRequiredInput("checkout_path"), + checkoutPath, ); const extensionFilePath = path.join(diffRangeDir, "pr-diff-range.yml"); fs.writeFileSync(extensionFilePath, extensionContents);