Skip to content

Commit cdafc35

Browse files
committed
refactor: pass checkoutPath as param to writeDiffRangeDataExtensionPack
1 parent c10020e commit cdafc35

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

lib/analyze-action.js

Lines changed: 8 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/analyze.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,12 @@ export async function setupDiffInformedQueryRun(
247247
`Calculating diff ranges for ${branches.base}...${branches.head}`,
248248
);
249249
const diffRanges = await getPullRequestEditedDiffRanges(branches, logger);
250-
const packDir = writeDiffRangeDataExtensionPack(logger, diffRanges);
250+
const checkoutPath = getRequiredInput("checkout_path");
251+
const packDir = writeDiffRangeDataExtensionPack(
252+
logger,
253+
diffRanges,
254+
checkoutPath,
255+
);
251256
if (packDir === undefined) {
252257
logger.warning(
253258
"Cannot create diff range extension pack for diff-informed queries; " +
@@ -310,12 +315,14 @@ extensions:
310315
* @param logger
311316
* @param ranges The file line ranges, as returned by
312317
* `getPullRequestEditedDiffRanges`.
318+
* @param checkoutPath The path at which the repository was checked out.
313319
* @returns The absolute path of the directory containing the extension pack, or
314320
* `undefined` if no extension pack was created.
315321
*/
316322
function writeDiffRangeDataExtensionPack(
317323
logger: Logger,
318324
ranges: DiffThunkRange[] | undefined,
325+
checkoutPath: string,
319326
): string | undefined {
320327
if (ranges === undefined) {
321328
return undefined;
@@ -353,7 +360,7 @@ dataExtensions:
353360

354361
const extensionContents = diffRangeExtensionPackContents(
355362
ranges,
356-
getRequiredInput("checkout_path"),
363+
checkoutPath,
357364
);
358365
const extensionFilePath = path.join(diffRangeDir, "pr-diff-range.yml");
359366
fs.writeFileSync(extensionFilePath, extensionContents);

0 commit comments

Comments
 (0)