Add base branches as configuration

This commit is contained in:
Jorge Navarro
2021-04-30 01:28:36 +02:00
parent 088993b64c
commit c49b84ec4a
7 changed files with 92 additions and 2 deletions
+3 -1
View File
@@ -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
}
+3
View File
@@ -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 || '',
+5
View File
@@ -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 || '',