From a22cce0ed879f87818fe3f884f82bc213ec0d9c7 Mon Sep 17 00:00:00 2001 From: adrian-321 Date: Fri, 1 Aug 2025 16:48:54 +1000 Subject: [PATCH] Fixed bug in the customProperties type Signed-off-by: adrian-321 --- .changeset/rotten-rats-dream.md | 5 +++++ plugins/scaffolder-backend-module-github/report.api.md | 4 ++-- .../src/actions/github.test.ts | 4 ++-- .../src/actions/githubRepoCreate.test.ts | 4 ++-- .../scaffolder-backend-module-github/src/actions/helpers.ts | 2 +- .../src/actions/inputProperties.ts | 4 ++-- 6 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 .changeset/rotten-rats-dream.md diff --git a/.changeset/rotten-rats-dream.md b/.changeset/rotten-rats-dream.md new file mode 100644 index 0000000000..65cb58b43a --- /dev/null +++ b/.changeset/rotten-rats-dream.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder-backend-module-github': patch +--- + +Fixed bug in the `customProperties` type which was preventing it being used to set a list of values against a key (e.g. for multi-select fields) diff --git a/plugins/scaffolder-backend-module-github/report.api.md b/plugins/scaffolder-backend-module-github/report.api.md index 2941be7702..85ca128c34 100644 --- a/plugins/scaffolder-backend-module-github/report.api.md +++ b/plugins/scaffolder-backend-module-github/report.api.md @@ -267,7 +267,7 @@ export function createGithubRepoCreateAction(options: { | undefined; requiredCommitSigning?: boolean | undefined; requiredLinearHistory?: boolean | undefined; - customProperties?: Record | undefined; + customProperties?: Record | undefined; subscribe?: boolean | undefined; }, { @@ -426,7 +426,7 @@ export function createPublishGithubAction(options: { | undefined; requiredCommitSigning?: boolean | undefined; requiredLinearHistory?: boolean | undefined; - customProperties?: Record | undefined; + customProperties?: Record | undefined; subscribe?: boolean | undefined; }, { diff --git a/plugins/scaffolder-backend-module-github/src/actions/github.test.ts b/plugins/scaffolder-backend-module-github/src/actions/github.test.ts index 2fd377ee04..ed6422f090 100644 --- a/plugins/scaffolder-backend-module-github/src/actions/github.test.ts +++ b/plugins/scaffolder-backend-module-github/src/actions/github.test.ts @@ -330,7 +330,7 @@ describe('publish:github', () => { ...mockContext.input, customProperties: { foo: 'bar', - foo2: 'bar2', + foo2: ['bar2', 'bar3'], }, }, }); @@ -505,7 +505,7 @@ describe('publish:github', () => { ...mockContext.input, customProperties: { foo: 'bar', - foo2: 'bar2', + foo2: ['bar2', 'bar3'], }, }, }); diff --git a/plugins/scaffolder-backend-module-github/src/actions/githubRepoCreate.test.ts b/plugins/scaffolder-backend-module-github/src/actions/githubRepoCreate.test.ts index cc8f65a5ba..b90f0c4e5a 100644 --- a/plugins/scaffolder-backend-module-github/src/actions/githubRepoCreate.test.ts +++ b/plugins/scaffolder-backend-module-github/src/actions/githubRepoCreate.test.ts @@ -279,7 +279,7 @@ describe('github:repo:create', () => { ...mockContext.input, customProperties: { foo: 'bar', - foo2: 'bar2', + foo2: ['bar2', 'bar3'], }, }, }); @@ -455,7 +455,7 @@ describe('github:repo:create', () => { ...mockContext.input, customProperties: { foo: 'bar', - foo2: 'bar2', + foo2: ['bar2', 'bar3'], }, }, }); diff --git a/plugins/scaffolder-backend-module-github/src/actions/helpers.ts b/plugins/scaffolder-backend-module-github/src/actions/helpers.ts index db3aa03679..6509d7fd29 100644 --- a/plugins/scaffolder-backend-module-github/src/actions/helpers.ts +++ b/plugins/scaffolder-backend-module-github/src/actions/helpers.ts @@ -75,7 +75,7 @@ export async function createGithubRepoWithCollaboratorsAndTopics( includeClaimKeys?: string[]; } | undefined, - customProperties: { [key: string]: string } | undefined, + customProperties: { [key: string]: string | string[] } | undefined, subscribe: boolean | undefined, logger: LoggerService, ) { diff --git a/plugins/scaffolder-backend-module-github/src/actions/inputProperties.ts b/plugins/scaffolder-backend-module-github/src/actions/inputProperties.ts index 7b58de4a5a..e1df40f85d 100644 --- a/plugins/scaffolder-backend-module-github/src/actions/inputProperties.ts +++ b/plugins/scaffolder-backend-module-github/src/actions/inputProperties.ts @@ -385,9 +385,9 @@ const oidcCustomization = (z: typeof zod) => const customProperties = (z: typeof zod) => z - .record(z.string(), { + .record(z.union([z.string(), z.array(z.string())]), { description: - 'Custom properties to be added to the repository (note, this only works for organization repositories)', + 'Custom properties to be added to the repository (note, this only works for organization repositories). All values must be strings', }) .optional();