- introduce new additional placeholders useable for building the changelog

| **Placeholder**            | **Description**                                                                                    | **Empty** |
|----------------------------|----------------------------------------------------------------------------------------------------|:---------:|
| `${{CHANGED_FILES}}`       | The count of changed files.                                                                        |           |
| `${{ADDITIONS}}`           | The count of code additions (lines).                                                               |           |
| `${{DELETIONS}}`           | The count of code deletions (lines).                                                               |           |
| `${{CHANGES}}`             | The count of total changes (lines).                                                                |           |
| `${{COMMITS}}`             | The count of commits in this release.                                                              |           |

- restructure project to return additional diff related information along the individual commits
- update testcases to verify functionality of new placeholders
This commit is contained in:
Mike Penz
2022-07-26 14:14:16 +02:00
parent 2b8bedc47a
commit 55354469a8
11 changed files with 245 additions and 108 deletions
+14 -13
View File
@@ -2,6 +2,7 @@ import {buildChangelog} from '../src/transform'
import {PullRequestInfo} from '../src/pullRequests'
import moment from 'moment'
import { DefaultConfiguration, Configuration } from '../src/configuration';
import { DefaultDiffInfo } from '../src/commits';
jest.setTimeout(180000)
@@ -130,7 +131,7 @@ it('Extract label from title, combined regex', async () => {
}
]
const resultChangelog = buildChangelog(mergedPullRequests, {
const resultChangelog = buildChangelog(DefaultDiffInfo, mergedPullRequests, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: '1.0.0',
@@ -159,7 +160,7 @@ it('Extract label from title and body, combined regex', async () => {
let prs = Array.from(mergedPullRequests)
prs.push(pullRequestWithLabelInBody)
const resultChangelog = buildChangelog(prs, {
const resultChangelog = buildChangelog(DefaultDiffInfo, prs, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: '1.0.0',
@@ -190,7 +191,7 @@ it('Extract label from title, split regex', async () => {
}
]
const resultChangelog = buildChangelog(mergedPullRequests, {
const resultChangelog = buildChangelog(DefaultDiffInfo, mergedPullRequests, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: '1.0.0',
@@ -221,7 +222,7 @@ it('Extract label from title, match', async () => {
}
]
const resultChangelog = buildChangelog(mergedPullRequests, {
const resultChangelog = buildChangelog(DefaultDiffInfo, mergedPullRequests, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: '1.0.0',
@@ -247,7 +248,7 @@ it('Extract label from title, match multiple', async () => {
}
]
const resultChangelog = buildChangelog(mergedPullRequests, {
const resultChangelog = buildChangelog(DefaultDiffInfo, mergedPullRequests, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: '1.0.0',
@@ -274,7 +275,7 @@ it('Extract label from title, match multiple, custon non matching label', async
}
]
const resultChangelog = buildChangelog(mergedPullRequests, {
const resultChangelog = buildChangelog(DefaultDiffInfo, mergedPullRequests, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: '1.0.0',
@@ -388,7 +389,7 @@ it('Match multiple labels exhaustive for category', async () => {
}
]
const resultChangelog = buildChangelog(pullRequestsWithLabels, {
const resultChangelog = buildChangelog(DefaultDiffInfo, pullRequestsWithLabels, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: '1.0.0',
@@ -413,7 +414,7 @@ it('Deduplicate duplicated PRs', async () => {
method: 'match'
}
const resultChangelog = buildChangelog(pullRequestsWithLabels, {
const resultChangelog = buildChangelog(DefaultDiffInfo, pullRequestsWithLabels, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: '1.0.0',
@@ -439,7 +440,7 @@ it('Deduplicate duplicated PRs DESC', async () => {
method: 'match'
}
const resultChangelog = buildChangelog(pullRequestsWithLabels, {
const resultChangelog = buildChangelog(DefaultDiffInfo, pullRequestsWithLabels, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: '1.0.0',
@@ -471,7 +472,7 @@ it('Use empty_content for empty category', async () => {
}
]
const resultChangelog = buildChangelog(pullRequestsWithLabels, {
const resultChangelog = buildChangelog(DefaultDiffInfo, pullRequestsWithLabels, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: '1.0.0',
@@ -493,7 +494,7 @@ it('Commit SHA-1 in commitMode', async () => {
customConfig.sort = "DESC"
customConfig.pr_template = "${{MERGE_SHA}}"
const resultChangelog = buildChangelog(pullRequestsWithLabels, {
const resultChangelog = buildChangelog(DefaultDiffInfo, pullRequestsWithLabels, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: '1.0.0',
@@ -514,7 +515,7 @@ it('Release Diff', async () => {
const customConfig = Object.assign({}, DefaultConfiguration)
customConfig.template = "${{RELEASE_DIFF}}"
const resultChangelog = buildChangelog(pullRequestsWithLabels, {
const resultChangelog = buildChangelog(DefaultDiffInfo, pullRequestsWithLabels, {
owner: 'mikepenz',
repo: 'release-changelog-builder-action',
fromTag: 'v2.8.0',
@@ -553,7 +554,7 @@ it('Use exclude labels to not include a PR within a category.', async () => {
}
]
const resultChangelog = buildChangelog(pullRequestsWithLabels, {
const resultChangelog = buildChangelog(DefaultDiffInfo, pullRequestsWithLabels, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: '1.0.0',