- 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:
+17
-1
@@ -2,7 +2,7 @@ import * as core from '@actions/core'
|
||||
import {Octokit, RestEndpointMethodTypes} from '@octokit/rest'
|
||||
import {Unpacked} from './utils'
|
||||
import moment from 'moment'
|
||||
import {Sort} from './configuration'
|
||||
import {Property, Sort} from './configuration'
|
||||
|
||||
export interface PullRequestInfo {
|
||||
number: number
|
||||
@@ -226,6 +226,22 @@ export function compare(a: PullRequestInfo, b: PullRequestInfo, sort: Sort): num
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to retrieve a property from the PullRequestInfo
|
||||
*/
|
||||
export function retrieveProperty(pr: PullRequestInfo, property: Property, useCase: string): string {
|
||||
let value: string | Set<string> | string[] | undefined = pr[property]
|
||||
if (value === undefined) {
|
||||
core.warning(`⚠️ the provided property '${property}' for \`${useCase}\` is not valid. Fallback to 'body'`)
|
||||
value = pr['body']
|
||||
} else if (value instanceof Set) {
|
||||
value = Array.from(value).join(',') // join into single string
|
||||
} else if (Array.isArray(value)) {
|
||||
value = value.join(',') // join into single string
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
// helper function to add a special open label to prs not merged.
|
||||
function attachSpeciaLabels(status: 'open' | 'merged', labels: Set<string>): Set<string> {
|
||||
labels.add(`--rcba-${status}`)
|
||||
|
||||
Reference in New Issue
Block a user