From 801656d2abcc479b548da2ec98f8aa4738222c54 Mon Sep 17 00:00:00 2001 From: Brandon Mikeska Date: Fri, 20 Oct 2023 16:47:21 -0500 Subject: [PATCH 1/3] Fix multiple workItem filters spread out the filters before pushing --- packages/sfpowerscripts-cli/src/impl/release/ReleaseImpl.ts | 2 +- .../tests/impl/changelog/WorkItemUpdater.test.ts | 2 +- 2 files changed, 2 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..fcaa41dca 100644 --- a/packages/sfpowerscripts-cli/src/impl/release/ReleaseImpl.ts +++ b/packages/sfpowerscripts-cli/src/impl/release/ReleaseImpl.ts @@ -79,7 +79,7 @@ export default class ReleaseImpl { for (const releaseDefinition of this.props.releaseDefinitions) { releaseName = releaseName.concat(releaseDefinition.release, '-'); if (releaseDefinition.changelog) { - workitemFilters.push(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( From 94cd075421fe1d3887bb2803a5db1ed107405c5f Mon Sep 17 00:00:00 2001 From: Azlam <43767972+azlam-abdulsalam@users.noreply.github.com> Date: Tue, 24 Oct 2023 13:15:48 +1100 Subject: [PATCH 2/3] fix: apply codefactor suggestion --- packages/sfpowerscripts-cli/src/impl/release/ReleaseImpl.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sfpowerscripts-cli/src/impl/release/ReleaseImpl.ts b/packages/sfpowerscripts-cli/src/impl/release/ReleaseImpl.ts index fcaa41dca..491a10d3b 100644 --- a/packages/sfpowerscripts-cli/src/impl/release/ReleaseImpl.ts +++ b/packages/sfpowerscripts-cli/src/impl/release/ReleaseImpl.ts @@ -79,7 +79,7 @@ export default class ReleaseImpl { for (const releaseDefinition of this.props.releaseDefinitions) { releaseName = releaseName.concat(releaseDefinition.release, '-'); if (releaseDefinition.changelog) { - workitemFilters.push(...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; From 2d762e978cedfa8f1c48c6228ad5ae85cf11a82d Mon Sep 17 00:00:00 2001 From: Azlam <43767972+azlam-abdulsalam@users.noreply.github.com> Date: Tue, 24 Oct 2023 13:31:23 +1100 Subject: [PATCH 3/3] fix(release): apply codefactor suggestion --- packages/sfpowerscripts-cli/src/impl/release/ReleaseImpl.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/sfpowerscripts-cli/src/impl/release/ReleaseImpl.ts b/packages/sfpowerscripts-cli/src/impl/release/ReleaseImpl.ts index 491a10d3b..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;