- expand custom assignment and add testcase to verify ability to construct custom categories involving states of PRs

This commit is contained in:
Mike Penz
2022-04-08 11:00:40 +02:00
parent 6211ea4995
commit f60b8b4167
6 changed files with 57 additions and 10 deletions
+7 -3
View File
@@ -160,8 +160,11 @@ export function sortPullRequests(
}
// helper function to add a special open label to prs not merged.
function addOpenLabel(labels: Set<string>): Set<string> {
labels.add('##rcba-open')
function attachSpeciaLabels(
status: 'open' | 'merged',
labels: Set<string>
): Set<string> {
labels.add(`--rcba-${status}`)
return labels
}
@@ -178,7 +181,8 @@ const mapPullRequest = (
mergeCommitSha: pr.merge_commit_sha || '',
author: pr.user?.login || '',
repoName: pr.base.repo.full_name,
labels: addOpenLabel(
labels: attachSpeciaLabels(
status,
new Set(
pr.labels?.map(lbl => lbl.name?.toLocaleLowerCase('en') || '') || []
)