- introduce new rules for the Category

- the rules can be used to match specified `Properties` with a `RegExp` (uses `test`) - to add them into a category
  - This allows more complex changelogs to be constructed, which for example want all `OPEN` PRs in one category
This commit is contained in:
Mike Penz
2023-01-03 17:29:56 +00:00
committed by GitHub
parent 96975870c4
commit 793329d870
8 changed files with 179 additions and 85 deletions
+23 -3
View File
@@ -20,12 +20,32 @@ export interface Configuration {
export interface Category {
title: string // the title of this category
labels: string[] // labels to associate PRs to this category
labels?: string[] // labels to associate PRs to this category
exclude_labels?: string[] // if an exclude label is detected, the PR will be excluded from this category
exhaustive?: boolean // requires all labels to be present in the PR
rules?: Rule[] // rules to associate PRs to this category
exhaustive?: boolean // requires all labels AND/OR rules to be present in the PR
empty_content?: string // if the category has no matching PRs, this content will be used. If not set, the category will be skipped in the changelog.
}
/**
* Defines the properties of the PullRequestInfo useable in different configurations
*/
export type Property =
| 'title'
| 'branch'
| 'author'
| 'labels'
| 'milestone'
| 'body'
| 'assignees'
| 'requestedReviewers'
| 'approvedReviewers'
| 'status'
export interface Rule extends Regex {
on_property?: Property // retrieve the property to apply the rule on
}
export interface Sort {
order: 'ASC' | 'DESC' // the sorting order
on_property: 'mergedAt' | 'title' // the property to sort on. (mergedAt falls back to createdAt)
@@ -41,7 +61,7 @@ export interface Transformer extends Regex {
}
export interface Extractor extends Transformer {
on_property?: ('title' | 'author' | 'milestone' | 'body' | 'branch')[] | 'title' | 'author' | 'milestone' | 'body' | 'branch' | undefined // retrieve the property to extract the value from
on_property?: Property[] | Property | undefined // retrieve the property to extract the value from
method?: 'replace' | 'match' | undefined // the method to use to extract the value, `match` will not use the `target` property
on_empty?: string | undefined // in case the regex results in an empty string, this value is gonna be used instead (only for label_extractor currently)
}