From ede7266c4b97e4c133d5848ab3a79d66dbc38608 Mon Sep 17 00:00:00 2001 From: Brandon Mikeska Date: Mon, 23 Oct 2023 21:34:31 -0500 Subject: [PATCH] fix(WorkItemFilters): Support multiple workItem filters (#1429) * Fix multiple workItem filters spread out the filters before pushing * fix: apply codefactor suggestion * fix(release): apply codefactor suggestion --------- Co-authored-by: Azlam <43767972+azlam-abdulsalam@users.noreply.github.com> --- packages/sfpowerscripts-cli/src/impl/release/ReleaseImpl.ts | 4 +++- .../tests/impl/changelog/WorkItemUpdater.test.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/sfpowerscripts-cli/src/impl/release/ReleaseImpl.ts b/packages/sfpowerscripts-cli/src/impl/release/ReleaseImpl.ts index 9d8533393..dc7eddbff 100644 --- a/packages/sfpowerscripts-cli/src/impl/release/ReleaseImpl.ts +++ b/packages/sfpowerscripts-cli/src/impl/release/ReleaseImpl.ts @@ -79,7 +79,9 @@ export default class ReleaseImpl { for (const releaseDefinition of this.props.releaseDefinitions) { releaseName = releaseName.concat(releaseDefinition.release, '-'); if (releaseDefinition.changelog) { - workitemFilters.push(releaseDefinition.changelog?.workItemFilters); + if(releaseDefinition.changelog.workItemFilters) { + workitemFilters.push(...releaseDefinition.changelog?.workItemFilters); + } if (releaseDefinition.changelog.limit > limit) limit = releaseDefinition.changelog.limit; workItemUrl = releaseDefinition.changelog.workItemUrl; showAllArtifacts = releaseDefinition.changelog.showAllArtifacts; diff --git a/packages/sfpowerscripts-cli/tests/impl/changelog/WorkItemUpdater.test.ts b/packages/sfpowerscripts-cli/tests/impl/changelog/WorkItemUpdater.test.ts index 4b4c53a0e..d4bba472e 100644 --- a/packages/sfpowerscripts-cli/tests/impl/changelog/WorkItemUpdater.test.ts +++ b/packages/sfpowerscripts-cli/tests/impl/changelog/WorkItemUpdater.test.ts @@ -8,7 +8,7 @@ describe('Given a WorkItemUpdater', () => { const resourceDir: string = path.join(__dirname, 'resources'); it('should update latestRelease with work items', () => { - new WorkItemUpdater(latestRelease, ['NGV-[0-9]{3,4}']).update(); + new WorkItemUpdater(latestRelease, ['NGV-[0-9]{3,4}', 'TEST-[0-9]{3,4}']).update(); expect(latestRelease).toEqual( fs.readJSONSync(