Skip to content

Commit

Permalink
- introduce new flag to include open PRs into the changelog
Browse files Browse the repository at this point in the history
  - only fetch open with this flag
- expand pull request spec with
  - status, created at timestamp
- expand definition for placeholder patterns in the changelog
  • Loading branch information
mikepenz committed Apr 8, 2022
1 parent 2114e8b commit c15aea0
Show file tree
Hide file tree
Showing 10 changed files with 333 additions and 58 deletions.
8 changes: 8 additions & 0 deletions __tests__/releaseNotes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ it('Should have empty changelog (tags)', async () => {
repo: 'release-changelog-builder-action',
fromTag: 'v0.0.1',
toTag: 'v0.0.2',
includeOpen: false,
failOnError: false,
commitMode: false,
configuration
Expand All @@ -33,6 +34,7 @@ it('Should match generated changelog (tags)', async () => {
repo: 'release-changelog-builder-action',
fromTag: 'v0.0.1',
toTag: 'v0.0.3',
includeOpen: false,
failOnError: false,
commitMode: false,
configuration
Expand All @@ -58,6 +60,7 @@ it('Should match generated changelog (refs)', async () => {
repo: 'release-changelog-builder-action',
fromTag: '5ec7a2d86fe9f43fdd38d5e254a1117c8a51b4c3',
toTag: 'fa3788c8c4b3373ef8424ce3eb008a5cd07cc5aa',
includeOpen: false,
failOnError: false,
commitMode: false,
configuration
Expand Down Expand Up @@ -91,6 +94,7 @@ it('Should match generated changelog and replace all occurrences (refs)', async
repo: 'release-changelog-builder-action',
fromTag: '5ec7a2d86fe9f43fdd38d5e254a1117c8a51b4c3',
toTag: 'fa3788c8c4b3373ef8424ce3eb008a5cd07cc5aa',
includeOpen: false,
failOnError: false,
commitMode: false,
configuration
Expand Down Expand Up @@ -126,6 +130,7 @@ it('Should match ordered ASC', async () => {
repo: 'release-changelog-builder-action',
fromTag: 'v0.3.0',
toTag: 'v0.5.0',
includeOpen: false,
failOnError: false,
commitMode: false,
configuration
Expand All @@ -148,6 +153,7 @@ it('Should match ordered DESC', async () => {
repo: 'release-changelog-builder-action',
fromTag: 'v0.3.0',
toTag: 'v0.5.0',
includeOpen: false,
failOnError: false,
commitMode: false,
configuration
Expand All @@ -170,6 +176,7 @@ it('Should ignore PRs not merged into develop branch', async () => {
repo: 'release-changelog-builder-action',
fromTag: 'v1.3.1',
toTag: 'v1.4.0',
includeOpen: false,
failOnError: false,
commitMode: false,
configuration
Expand All @@ -190,6 +197,7 @@ it('Should ignore PRs not merged into main branch', async () => {
repo: 'release-changelog-builder-action',
fromTag: 'v1.3.1',
toTag: 'v1.4.0',
includeOpen: false,
failOnError: false,
commitMode: false,
configuration
Expand Down
37 changes: 37 additions & 0 deletions __tests__/releaseNotesBuilder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ it('Should match generated changelog (unspecified fromTag)', async () => {
false,
false,
false,
false,
configuration
)

Expand All @@ -42,6 +43,7 @@ it('Should match generated changelog (unspecified tags)', async () => {
false,
false,
false,
false,
configuration
)

Expand All @@ -65,6 +67,7 @@ it('Should use empty placeholder', async () => {
false,
false,
false,
false,
configuration
)

Expand All @@ -89,6 +92,7 @@ it('Should fill empty placeholders', async () => {
false,
false,
false,
false,
configuration
)

Expand All @@ -115,6 +119,7 @@ it('Should fill `template` placeholders', async () => {
false,
false,
false,
false,
configuration
)

Expand All @@ -141,6 +146,7 @@ it('Should fill `template` placeholders, ignore', async () => {
false,
false,
false,
false,
configuration
)

Expand All @@ -167,6 +173,7 @@ it('Uncategorized category', async () => {
false,
false,
false,
false,
configuration
)

Expand All @@ -192,6 +199,7 @@ it('Verify commit based changelog', async () => {
'v0.0.3',
false,
false,
false,
true,
configuration
)
Expand All @@ -218,6 +226,7 @@ it('Verify commit based changelog, with emoji categorisation', async () => {
'17a9e4dfaedcabe6a6eff2754bebb715e1c58ec4',
false,
false,
false,
true,
configuration
)
Expand All @@ -228,3 +237,31 @@ it('Verify commit based changelog, with emoji categorisation', async () => {
`## 🚀 Features\n\n- add dynamic merging\n- add auto-cleaning\n- add built-in adb support\n- add adb fallback (thanks to @mikepenz ;))\n- add install note\n- add @mikepenz to credits\n\n## 🐛 Fixes\n\n- fix dynamic lib replacement\n- fix apostrophe issue with app name\n- fix java.util.logger error\n\n## 💬 Other\n\n- update screenshot with truecaller stack\n\n`
)
})


it('Verify inclusion of open PRs', async () => {
const configuration = resolveConfiguration(
'',
'configs_test/configuration_commits_emoji.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, // commitMode
configuration // configuration
)

const changeLog = await releaseNotesBuilder.build()
console.log(changeLog)
expect(changeLog).toStrictEqual(
``
)
})

0 comments on commit c15aea0

Please sign in to comment.