From 38d71169efd08afba3fbef92928846c524ace3b7 Mon Sep 17 00:00:00 2001 From: Mark Foresta Date: Sat, 12 Oct 2024 10:39:41 -0400 Subject: [PATCH] Use path dirname rather than parsing it manually Signed-off-by: Mark Foresta --- .../src/scaffolder/dryrun/createDryRunner.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/scaffolder-backend/src/scaffolder/dryrun/createDryRunner.ts b/plugins/scaffolder-backend/src/scaffolder/dryrun/createDryRunner.ts index 3ed99d080c..0d4adfece2 100644 --- a/plugins/scaffolder-backend/src/scaffolder/dryrun/createDryRunner.ts +++ b/plugins/scaffolder-backend/src/scaffolder/dryrun/createDryRunner.ts @@ -28,6 +28,7 @@ import { SerializedFile, serializeDirectoryContents, } from '@backstage/plugin-scaffolder-node'; +import path from 'path'; import { TemplateActionRegistry } from '../actions'; import { NunjucksWorkflowRunner } from '../tasks/NunjucksWorkflowRunner'; import { DecoratedActionsRegistry } from './DecoratedActionsRegistry'; @@ -97,7 +98,7 @@ export function createDryRunner(options: TemplateTesterCreateOptions) { throw new Error('baseUrl is required'); } const basePath = fileURLToPath(new URL(baseUrl)); - const contentsPath = basePath.replace('template.yaml', ''); + const contentsPath = path.dirname(basePath); const dryRunId = contentsPath .replace(options.workingDirectory, '') .replace('dry-run-content-', '');