- introduce new MERGE_SHA placeholder support into template for PRs (and commit SHA for commit mode)

- FIX https://github.com/mikepenz/release-changelog-builder-action/issues/552
This commit is contained in:
Mike Penz
2021-10-22 22:18:06 +02:00
parent 3466e55ab2
commit f93f67fad5
6 changed files with 30 additions and 7 deletions
+24 -4
View File
@@ -201,7 +201,7 @@ pullRequestsWithLabels.push(
htmlURL: '',
baseBranch: '',
mergedAt: moment(),
mergeCommitSha: 'sha1',
mergeCommitSha: 'sha1-1',
author: 'Mike',
repoName: 'test-repo',
labels: new Set<string>().add('feature'),
@@ -216,7 +216,7 @@ pullRequestsWithLabels.push(
htmlURL: '',
baseBranch: '',
mergedAt: moment(),
mergeCommitSha: 'sha1',
mergeCommitSha: 'sha1-2',
author: 'Mike',
repoName: 'test-repo',
labels: new Set<string>().add('issue').add('fix'),
@@ -231,7 +231,7 @@ pullRequestsWithLabels.push(
htmlURL: '',
baseBranch: '',
mergedAt: moment().add(1, 'days'),
mergeCommitSha: 'sha1',
mergeCommitSha: 'sha1-3',
author: 'Mike',
repoName: 'test-repo',
labels: new Set<string>().add('issue').add('feature').add('fix'),
@@ -246,7 +246,7 @@ pullRequestsWithLabels.push(
htmlURL: '',
baseBranch: '',
mergedAt: moment(),
mergeCommitSha: 'sha1',
mergeCommitSha: 'sha1-4',
author: 'Mike',
repoName: 'test-repo',
labels: new Set<string>().add(''),
@@ -337,4 +337,24 @@ it('Deduplicate duplicated PRs DESC', async () => {
expect(resultChangelog).toStrictEqual(
`## 🚀 Features\n\n- [ABC-1234] - this is a PR 1 title message\n - PR: #1\n\n## 🐛 Fixes\n\n- [ABC-4321] - this is a PR 2 title message\n - PR: #2\n\n`
)
})
it('Commit SHA-1 in commitMode', async () => {
const customConfig = Object.assign({}, DefaultConfiguration)
customConfig.sort = "DESC"
customConfig.pr_template = "${{MERGE_SHA}}"
const resultChangelog = buildChangelog(pullRequestsWithLabels, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: '1.0.0',
toTag: '2.0.0',
failOnError: false,
commitMode: true,
configuration: customConfig
})
expect(resultChangelog).toStrictEqual(
`## 🚀 Features\n\nsha1-3\nsha1-1\n\n## 🐛 Fixes\n\nsha1-3\nsha1-2\n\n`
)
})