Add base branches as configuration
This commit is contained in:
@@ -12,6 +12,7 @@ export interface Configuration {
|
||||
label_extractor: Extractor[]
|
||||
transformers: Transformer[]
|
||||
tag_resolver: TagResolver
|
||||
base_branches: string[]
|
||||
}
|
||||
|
||||
export interface Category {
|
||||
@@ -61,5 +62,6 @@ export const DefaultConfiguration: Configuration = {
|
||||
tag_resolver: {
|
||||
// defines the logic on how to resolve the previous tag, only relevant if `fromTag` is not specified
|
||||
method: 'semver' // defines which method to use, by default it will use `semver` (dropping all non matching tags). Alternative `sort` is also available.
|
||||
}
|
||||
},
|
||||
base_branches: [] // target branches for the merged PR ignoring PRs with different target branch, by default it will get all PRs
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ export interface PullRequestInfo {
|
||||
number: number
|
||||
title: string
|
||||
htmlURL: string
|
||||
baseBranch: string
|
||||
mergedAt: moment.Moment
|
||||
mergeCommitSha: string
|
||||
author: string
|
||||
@@ -37,6 +38,7 @@ export class PullRequests {
|
||||
number: pr.data.number,
|
||||
title: pr.data.title,
|
||||
htmlURL: pr.data.html_url,
|
||||
baseBranch: pr.data.base.ref,
|
||||
mergedAt: moment(pr.data.merged_at),
|
||||
mergeCommitSha: pr.data.merge_commit_sha || '',
|
||||
author: pr.data.user?.login || '',
|
||||
@@ -90,6 +92,7 @@ export class PullRequests {
|
||||
number: pr.number,
|
||||
title: pr.title,
|
||||
htmlURL: pr.html_url,
|
||||
baseBranch: pr.base.ref,
|
||||
mergedAt: moment(pr.merged_at),
|
||||
mergeCommitSha: pr.merge_commit_sha || '',
|
||||
author: pr.user?.login || '',
|
||||
|
||||
@@ -130,7 +130,11 @@ export class ReleaseNotes {
|
||||
|
||||
// return only the pull requests associated with this release
|
||||
return pullRequests.filter(pr => {
|
||||
const baseBranches = configuration.base_branches || DefaultConfiguration.base_branches
|
||||
const allBaseBranchesAllowed = baseBranches.length === 0
|
||||
|
||||
return releaseCommitHashes.includes(pr.mergeCommitSha)
|
||||
&& (allBaseBranchesAllowed || baseBranches.includes(pr.baseBranch))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -157,6 +161,7 @@ export class ReleaseNotes {
|
||||
number: 0,
|
||||
title: commit.summary,
|
||||
htmlURL: '',
|
||||
baseBranch: '',
|
||||
mergedAt: commit.date,
|
||||
mergeCommitSha: '',
|
||||
author: commit.author || '',
|
||||
|
||||
Reference in New Issue
Block a user