- slightly improve filtering code

- format config / readme
This commit is contained in:
Mike Penz
2021-04-30 10:29:09 +02:00
parent c49b84ec4a
commit 3a59a463ad
4 changed files with 51 additions and 38 deletions
+3 -1
View File
@@ -191,7 +191,9 @@ This configuration is a `.json` file in the following format.
"tag_resolver": { "tag_resolver": {
"method": "semver" "method": "semver"
}, },
"base_branches": [] "base_branches": [
"dev"
]
} }
``` ```
@@ -2,7 +2,10 @@
"categories": [ "categories": [
{ {
"title": "", "title": "",
"labels": ["dev", "Bump"] "labels": [
"dev",
"Bump"
]
} }
], ],
"ignore_labels": [], "ignore_labels": [],
@@ -15,5 +18,7 @@
"on_property": "title" "on_property": "title"
} }
], ],
"base_branches": ["develop"] "base_branches": [
"develop"
]
} }
@@ -2,7 +2,10 @@
"categories": [ "categories": [
{ {
"title": "", "title": "",
"labels": ["dev", "Bump"] "labels": [
"dev",
"Bump"
]
} }
], ],
"ignore_labels": [], "ignore_labels": [],
@@ -15,5 +18,7 @@
"on_property": "title" "on_property": "title"
} }
], ],
"base_branches": ["main"] "base_branches": [
"main"
]
} }
+3 -2
View File
@@ -128,11 +128,12 @@ export class ReleaseNotes {
return commmit.sha return commmit.sha
}) })
// return only the pull requests associated with this release // retrieve base branches we allow
return pullRequests.filter(pr => {
const baseBranches = configuration.base_branches || DefaultConfiguration.base_branches const baseBranches = configuration.base_branches || DefaultConfiguration.base_branches
const allBaseBranchesAllowed = baseBranches.length === 0 const allBaseBranchesAllowed = baseBranches.length === 0
// return only the pull requests associated with this release
return pullRequests.filter(pr => {
return releaseCommitHashes.includes(pr.mergeCommitSha) return releaseCommitHashes.includes(pr.mergeCommitSha)
&& (allBaseBranchesAllowed || baseBranches.includes(pr.baseBranch)) && (allBaseBranchesAllowed || baseBranches.includes(pr.baseBranch))
}) })