- introduce new flag to include open PRs into the changelog

- only fetch open with this flag
- expand pull request spec with
  - status, created at timestamp
- expand definition for placeholder patterns in the changelog
This commit is contained in:
Mike Penz
2022-04-08 11:00:39 +02:00
parent 7a59e9f4b4
commit 85af6a8181
10 changed files with 333 additions and 58 deletions
+39 -9
View File
@@ -33,6 +33,7 @@ mergedPullRequests.push(
title: '[Feature][AB-1234] - this is a PR 1 title message',
htmlURL: '',
baseBranch: '',
createdAt: moment(),
mergedAt: moment(),
mergeCommitSha: 'sha1',
author: 'Mike',
@@ -41,13 +42,15 @@ mergedPullRequests.push(
milestone: '',
body: 'no magic body for this matter',
assignees: [],
requestedReviewers: []
requestedReviewers: [],
status: "merged"
},
{
number: 2,
title: '[Issue][AB-4321] - this is a PR 2 title message',
htmlURL: '',
baseBranch: '',
createdAt: moment(),
mergedAt: moment(),
mergeCommitSha: 'sha1',
author: 'Mike',
@@ -56,13 +59,15 @@ mergedPullRequests.push(
milestone: '',
body: 'no magic body for this matter',
assignees: [],
requestedReviewers: []
requestedReviewers: [],
status: "merged"
},
{
number: 3,
title: '[Issue][Feature][AB-1234321] - this is a PR 3 title message',
htmlURL: '',
baseBranch: '',
createdAt: moment(),
mergedAt: moment(),
mergeCommitSha: 'sha1',
author: 'Mike',
@@ -71,13 +76,15 @@ mergedPullRequests.push(
milestone: '',
body: 'no magic body for this matter',
assignees: [],
requestedReviewers: []
requestedReviewers: [],
status: "merged"
},
{
number: 4,
title: '[AB-404] - not found label',
htmlURL: '',
baseBranch: '',
createdAt: moment(),
mergedAt: moment(),
mergeCommitSha: 'sha1',
author: 'Mike',
@@ -86,7 +93,8 @@ mergedPullRequests.push(
milestone: '',
body: 'no magic body for this matter',
assignees: [],
requestedReviewers: []
requestedReviewers: [],
status: "merged"
}
)
@@ -95,6 +103,7 @@ const pullRequestWithLabelInBody: PullRequestInfo = {
title: 'label in body',
htmlURL: '',
baseBranch: '',
createdAt: moment(),
mergedAt: moment(),
mergeCommitSha: 'sha1',
author: 'Mike',
@@ -103,7 +112,8 @@ const pullRequestWithLabelInBody: PullRequestInfo = {
milestone: '',
body: '[Issue][Feature][AB-1234321] - no magic body for this matter',
assignees: [],
requestedReviewers: []
requestedReviewers: [],
status: "merged"
}
it('Extract label from title, combined regex', async () => {
@@ -120,6 +130,7 @@ it('Extract label from title, combined regex', async () => {
repo: 'test-repo',
fromTag: '1.0.0',
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
commitMode: false,
configuration
@@ -147,6 +158,7 @@ it('Extract label from title and body, combined regex', async () => {
repo: 'test-repo',
fromTag: '1.0.0',
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
commitMode: false,
configuration
@@ -176,6 +188,7 @@ it('Extract label from title, split regex', async () => {
repo: 'test-repo',
fromTag: '1.0.0',
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
commitMode: false,
configuration
@@ -205,6 +218,7 @@ it('Extract label from title, match', async () => {
repo: 'test-repo',
fromTag: '1.0.0',
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
commitMode: false,
configuration
@@ -229,6 +243,7 @@ it('Extract label from title, match multiple', async () => {
repo: 'test-repo',
fromTag: '1.0.0',
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
commitMode: false,
configuration
@@ -254,6 +269,7 @@ it('Extract label from title, match multiple, custon non matching label', async
repo: 'test-repo',
fromTag: '1.0.0',
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
commitMode: false,
configuration
@@ -272,6 +288,7 @@ pullRequestsWithLabels.push(
title: '[ABC-1234] - this is a PR 1 title message',
htmlURL: '',
baseBranch: '',
createdAt: moment(),
mergedAt: moment(),
mergeCommitSha: 'sha1-1',
author: 'Mike',
@@ -280,13 +297,15 @@ pullRequestsWithLabels.push(
milestone: '',
body: 'no magic body for this matter',
assignees: [],
requestedReviewers: []
requestedReviewers: [],
status: "merged"
},
{
number: 2,
title: '[ABC-4321] - this is a PR 2 title message',
htmlURL: '',
baseBranch: '',
createdAt: moment(),
mergedAt: moment(),
mergeCommitSha: 'sha1-2',
author: 'Mike',
@@ -295,13 +314,15 @@ pullRequestsWithLabels.push(
milestone: '',
body: 'no magic body for this matter',
assignees: [],
requestedReviewers: []
requestedReviewers: [],
status: "merged"
},
{
number: 3,
title: '[ABC-1234] - this is a PR 3 title message',
htmlURL: '',
baseBranch: '',
createdAt: moment(),
mergedAt: moment().add(1, 'days'),
mergeCommitSha: 'sha1-3',
author: 'Mike',
@@ -310,13 +331,15 @@ pullRequestsWithLabels.push(
milestone: '',
body: 'no magic body for this matter',
assignees: [],
requestedReviewers: []
requestedReviewers: [],
status: "merged"
},
{
number: 4,
title: '[AB-404] - not found label',
htmlURL: '',
baseBranch: '',
createdAt: moment(),
mergedAt: moment(),
mergeCommitSha: 'sha1-4',
author: 'Mike',
@@ -325,7 +348,8 @@ pullRequestsWithLabels.push(
milestone: '',
body: 'no magic body for this matter',
assignees: [],
requestedReviewers: []
requestedReviewers: [],
status: "merged"
}
)
@@ -354,6 +378,7 @@ it('Match multiple labels exhaustive for category', async () => {
repo: 'test-repo',
fromTag: '1.0.0',
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
commitMode: false,
configuration: customConfig
@@ -377,6 +402,7 @@ it('Deduplicate duplicated PRs', async () => {
repo: 'test-repo',
fromTag: '1.0.0',
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
commitMode: false,
configuration: customConfig
@@ -401,6 +427,7 @@ it('Deduplicate duplicated PRs DESC', async () => {
repo: 'test-repo',
fromTag: '1.0.0',
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
commitMode: false,
configuration: customConfig
@@ -421,6 +448,7 @@ it('Commit SHA-1 in commitMode', async () => {
repo: 'test-repo',
fromTag: '1.0.0',
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
commitMode: true,
configuration: customConfig
@@ -440,6 +468,7 @@ it('Release Diff', async () => {
repo: 'release-changelog-builder-action',
fromTag: 'v2.8.0',
toTag: 'v2.8.1',
includeOpen: false,
failOnError: false,
commitMode: true,
configuration: customConfig
@@ -477,6 +506,7 @@ it('Use exclude labels to not include a PR within a category.', async () => {
repo: 'test-repo',
fromTag: '1.0.0',
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
commitMode: false,
configuration: customConfig