- introduce new flag allowing to fetch reviewers who approved PRs

- add new testcase which verifies approvers being included
  - adjust config for some test cases to verify reviewers not being pulled if disabled
This commit is contained in:
Mike Penz
2022-04-08 12:13:21 +02:00
parent df9a35580f
commit 1e867df2de
13 changed files with 181 additions and 11 deletions
+8
View File
@@ -18,6 +18,7 @@ it('Should have empty changelog (tags)', async () => {
toTag: 'v0.0.2',
includeOpen: false,
failOnError: false,
fetchReviewers: false,
commitMode: false,
configuration
})
@@ -36,6 +37,7 @@ it('Should match generated changelog (tags)', async () => {
toTag: 'v0.0.3',
includeOpen: false,
failOnError: false,
fetchReviewers: false,
commitMode: false,
configuration
})
@@ -62,6 +64,7 @@ it('Should match generated changelog (refs)', async () => {
toTag: 'fa3788c8c4b3373ef8424ce3eb008a5cd07cc5aa',
includeOpen: false,
failOnError: false,
fetchReviewers: false,
commitMode: false,
configuration
})
@@ -96,6 +99,7 @@ it('Should match generated changelog and replace all occurrences (refs)', async
toTag: 'fa3788c8c4b3373ef8424ce3eb008a5cd07cc5aa',
includeOpen: false,
failOnError: false,
fetchReviewers: false,
commitMode: false,
configuration
})
@@ -132,6 +136,7 @@ it('Should match ordered ASC', async () => {
toTag: 'v0.5.0',
includeOpen: false,
failOnError: false,
fetchReviewers: false,
commitMode: false,
configuration
})
@@ -155,6 +160,7 @@ it('Should match ordered DESC', async () => {
toTag: 'v0.5.0',
includeOpen: false,
failOnError: false,
fetchReviewers: false,
commitMode: false,
configuration
})
@@ -178,6 +184,7 @@ it('Should ignore PRs not merged into develop branch', async () => {
toTag: 'v1.4.0',
includeOpen: false,
failOnError: false,
fetchReviewers: false,
commitMode: false,
configuration
})
@@ -199,6 +206,7 @@ it('Should ignore PRs not merged into main branch', async () => {
toTag: 'v1.4.0',
includeOpen: false,
failOnError: false,
fetchReviewers: false,
commitMode: false,
configuration
})
+39
View File
@@ -16,6 +16,7 @@ it('Should match generated changelog (unspecified fromTag)', async () => {
false,
false,
false,
false, // enable to fetch reviewers
false,
configuration
)
@@ -43,6 +44,7 @@ it('Should match generated changelog (unspecified tags)', async () => {
false,
false,
false,
false, // enable to fetch reviewers
false,
configuration
)
@@ -67,6 +69,7 @@ it('Should use empty placeholder', async () => {
false,
false,
false,
false, // enable to fetch reviewers
false,
configuration
)
@@ -92,6 +95,7 @@ it('Should fill empty placeholders', async () => {
false,
false,
false,
false, // enable to fetch reviewers
false,
configuration
)
@@ -119,6 +123,7 @@ it('Should fill `template` placeholders', async () => {
false,
false,
false,
false, // enable to fetch reviewers
false,
configuration
)
@@ -146,6 +151,7 @@ it('Should fill `template` placeholders, ignore', async () => {
false,
false,
false,
false, // enable to fetch reviewers
false,
configuration
)
@@ -173,6 +179,7 @@ it('Uncategorized category', async () => {
false,
false,
false,
false, // enable to fetch reviewers
false,
configuration
)
@@ -200,6 +207,7 @@ it('Verify commit based changelog', async () => {
false,
false,
false,
false, // enable to fetch reviewers
true,
configuration
)
@@ -227,6 +235,7 @@ it('Verify commit based changelog, with emoji categorisation', async () => {
false,
false,
false,
false, // enable to fetch reviewers
true,
configuration
)
@@ -254,6 +263,7 @@ it('Verify default inclusion of open PRs', async () => {
true, // includeOpen
false, // failOnError
false, // ignorePrePrelease
false, // enable to fetch reviewers
false, // commitMode
configuration // configuration
)
@@ -281,6 +291,7 @@ it('Verify custom categorisation of open PRs', async () => {
true, // includeOpen
false, // failOnError
false, // ignorePrePrelease
false, // enable to fetch reviewers
false, // commitMode
configuration // configuration
)
@@ -291,3 +302,31 @@ it('Verify custom categorisation of open PRs', async () => {
`## 🚀 Features Merged\n\n- A feature to be going to v2 (nr3) -- (#3) [merged] {feature}\n\n## 🚀 Features Open\n\n- New feature to keep open (nr5) -- (#7) [open] {feature}\n\n`
)
})
it('Verify reviewers who approved are fetched', async () => {
const configuration = resolveConfiguration(
'',
'configs_test/configuration_approvers.json'
)
const releaseNotesBuilder = new ReleaseNotesBuilder(
null, // baseUrl
null, // token
'.', // repoPath
'mikepenz', // user
'release-changelog-builder-action-playground', // repo
'1.5.0', // fromTag
'2.0.0', // toTag
true, // includeOpen
false, // failOnError
false, // ignorePrePrelease
true, // enable to fetch reviewers
false, // commitMode
configuration // configuration
)
const changeLog = await releaseNotesBuilder.build()
console.log(changeLog)
expect(changeLog).toStrictEqual(
`## 🚀 Features\n\n- A feature to be going to v2 (nr3) -- (#3) [merged] --- \n- New feature to keep open (nr5) -- (#7) [open] --- gabrielpopa\n\n`
)
})
+21
View File
@@ -43,6 +43,7 @@ mergedPullRequests.push(
body: 'no magic body for this matter',
assignees: [],
requestedReviewers: [],
approvedReviewers: [],
status: "merged"
},
{
@@ -60,6 +61,7 @@ mergedPullRequests.push(
body: 'no magic body for this matter',
assignees: [],
requestedReviewers: [],
approvedReviewers: [],
status: "merged"
},
{
@@ -77,6 +79,7 @@ mergedPullRequests.push(
body: 'no magic body for this matter',
assignees: [],
requestedReviewers: [],
approvedReviewers: [],
status: "merged"
},
{
@@ -94,6 +97,7 @@ mergedPullRequests.push(
body: 'no magic body for this matter',
assignees: [],
requestedReviewers: [],
approvedReviewers: [],
status: "merged"
}
)
@@ -113,6 +117,7 @@ const pullRequestWithLabelInBody: PullRequestInfo = {
body: '[Issue][Feature][AB-1234321] - no magic body for this matter',
assignees: [],
requestedReviewers: [],
approvedReviewers: [],
status: "merged"
}
@@ -132,6 +137,7 @@ it('Extract label from title, combined regex', async () => {
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
fetchReviewers: false,
commitMode: false,
configuration
})
@@ -160,6 +166,7 @@ it('Extract label from title and body, combined regex', async () => {
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
fetchReviewers: false,
commitMode: false,
configuration
})
@@ -190,6 +197,7 @@ it('Extract label from title, split regex', async () => {
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
fetchReviewers: false,
commitMode: false,
configuration
})
@@ -220,6 +228,7 @@ it('Extract label from title, match', async () => {
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
fetchReviewers: false,
commitMode: false,
configuration
})
@@ -245,6 +254,7 @@ it('Extract label from title, match multiple', async () => {
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
fetchReviewers: false,
commitMode: false,
configuration
})
@@ -271,6 +281,7 @@ it('Extract label from title, match multiple, custon non matching label', async
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
fetchReviewers: false,
commitMode: false,
configuration
})
@@ -298,6 +309,7 @@ pullRequestsWithLabels.push(
body: 'no magic body for this matter',
assignees: [],
requestedReviewers: [],
approvedReviewers: [],
status: "merged"
},
{
@@ -315,6 +327,7 @@ pullRequestsWithLabels.push(
body: 'no magic body for this matter',
assignees: [],
requestedReviewers: [],
approvedReviewers: [],
status: "merged"
},
{
@@ -332,6 +345,7 @@ pullRequestsWithLabels.push(
body: 'no magic body for this matter',
assignees: [],
requestedReviewers: [],
approvedReviewers: [],
status: "merged"
},
{
@@ -349,6 +363,7 @@ pullRequestsWithLabels.push(
body: 'no magic body for this matter',
assignees: [],
requestedReviewers: [],
approvedReviewers: [],
status: "merged"
}
)
@@ -380,6 +395,7 @@ it('Match multiple labels exhaustive for category', async () => {
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
fetchReviewers: false,
commitMode: false,
configuration: customConfig
})
@@ -404,6 +420,7 @@ it('Deduplicate duplicated PRs', async () => {
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
fetchReviewers: false,
commitMode: false,
configuration: customConfig
})
@@ -429,6 +446,7 @@ it('Deduplicate duplicated PRs DESC', async () => {
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
fetchReviewers: false,
commitMode: false,
configuration: customConfig
})
@@ -450,6 +468,7 @@ it('Commit SHA-1 in commitMode', async () => {
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
fetchReviewers: false,
commitMode: true,
configuration: customConfig
})
@@ -470,6 +489,7 @@ it('Release Diff', async () => {
toTag: 'v2.8.1',
includeOpen: false,
failOnError: false,
fetchReviewers: false,
commitMode: true,
configuration: customConfig
})
@@ -508,6 +528,7 @@ it('Use exclude labels to not include a PR within a category.', async () => {
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
fetchReviewers: false,
commitMode: false,
configuration: customConfig
})