- introduce test cases for transform.test.ts

- add test case to highlight label extractor feature FIX https://github.com/mikepenz/release-changelog-builder-action/issues/450
  - test cases can easily be run via `npm test -- transform.test.ts`
- slightly simplify releaseNotes.ts and transform.ts
This commit is contained in:
Mike Penz
2021-08-26 16:05:04 +02:00
parent b9e099f9e4
commit a753722e84
5 changed files with 181 additions and 1292 deletions
+1 -7
View File
@@ -20,8 +20,6 @@ export class ReleaseNotes {
constructor(private octokit: Octokit, private options: ReleaseNotesOptions) {}
async pull(): Promise<string | null> {
const {configuration} = this.options
let mergedPullRequests: PullRequestInfo[]
if (!this.options.commitMode) {
core.startGroup(`🚀 Load pull requests`)
@@ -40,11 +38,7 @@ export class ReleaseNotes {
}
core.startGroup('📦 Build changelog')
const resultChangelog = buildChangelog(
mergedPullRequests,
configuration,
this.options
)
const resultChangelog = buildChangelog(mergedPullRequests, this.options)
core.endGroup()
return resultChangelog
}
+1 -2
View File
@@ -1,7 +1,6 @@
import * as core from '@actions/core'
import {
Category,
Configuration,
DefaultConfiguration,
Extractor,
Transformer
@@ -11,10 +10,10 @@ import {ReleaseNotesOptions} from './releaseNotes'
export function buildChangelog(
prs: PullRequestInfo[],
config: Configuration,
options: ReleaseNotesOptions
): string {
// sort to target order
const config = options.configuration
const sort = config.sort || DefaultConfiguration.sort
const sortAsc = sort.toUpperCase() === 'ASC'
prs = sortPullRequests(prs, sortAsc)