Merge pull request #831 from mikepenz/feature/830
Add `branch` name to `PullRequestInfo`
This commit is contained in:
+1
@@ -690,6 +690,7 @@ const mapPullRequest = (pr, status = 'open') => {
|
|||||||
title: pr.title,
|
title: pr.title,
|
||||||
htmlURL: pr.html_url,
|
htmlURL: pr.html_url,
|
||||||
baseBranch: pr.base.ref,
|
baseBranch: pr.base.ref,
|
||||||
|
branch: pr.head.ref,
|
||||||
createdAt: (0, moment_1.default)(pr.created_at),
|
createdAt: (0, moment_1.default)(pr.created_at),
|
||||||
mergedAt: pr.merged_at ? (0, moment_1.default)(pr.merged_at) : null,
|
mergedAt: pr.merged_at ? (0, moment_1.default)(pr.merged_at) : null,
|
||||||
mergeCommitSha: pr.merge_commit_sha || '',
|
mergeCommitSha: pr.merge_commit_sha || '',
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -40,11 +40,12 @@ export interface Transformer extends Regex {
|
|||||||
|
|
||||||
export interface Extractor extends Transformer {
|
export interface Extractor extends Transformer {
|
||||||
on_property?:
|
on_property?:
|
||||||
| ('title' | 'author' | 'milestone' | 'body')[]
|
| ('title' | 'author' | 'milestone' | 'body' | 'branch')[]
|
||||||
| 'title'
|
| 'title'
|
||||||
| 'author'
|
| 'author'
|
||||||
| 'milestone'
|
| 'milestone'
|
||||||
| 'body'
|
| 'body'
|
||||||
|
| 'branch'
|
||||||
| undefined // retrieve the property to extract the value from
|
| 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
|
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)
|
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)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ export interface PullRequestInfo {
|
|||||||
title: string
|
title: string
|
||||||
htmlURL: string
|
htmlURL: string
|
||||||
baseBranch: string
|
baseBranch: string
|
||||||
|
branch?: string
|
||||||
createdAt: moment.Moment
|
createdAt: moment.Moment
|
||||||
mergedAt: moment.Moment | null
|
mergedAt: moment.Moment | null
|
||||||
mergeCommitSha: string
|
mergeCommitSha: string
|
||||||
@@ -227,6 +228,7 @@ const mapPullRequest = (
|
|||||||
title: pr.title,
|
title: pr.title,
|
||||||
htmlURL: pr.html_url,
|
htmlURL: pr.html_url,
|
||||||
baseBranch: pr.base.ref,
|
baseBranch: pr.base.ref,
|
||||||
|
branch: pr.head.ref,
|
||||||
createdAt: moment(pr.created_at),
|
createdAt: moment(pr.created_at),
|
||||||
mergedAt: pr.merged_at ? moment(pr.merged_at) : null,
|
mergedAt: pr.merged_at ? moment(pr.merged_at) : null,
|
||||||
mergeCommitSha: pr.merge_commit_sha || '',
|
mergeCommitSha: pr.merge_commit_sha || '',
|
||||||
|
|||||||
+12
-4
@@ -462,12 +462,18 @@ function extractValues(
|
|||||||
|
|
||||||
if (extractor.onProperty !== undefined) {
|
if (extractor.onProperty !== undefined) {
|
||||||
let results: string[] = []
|
let results: string[] = []
|
||||||
const list: ('title' | 'author' | 'milestone' | 'body' | 'status')[] =
|
const list: (
|
||||||
extractor.onProperty
|
| 'title'
|
||||||
|
| 'author'
|
||||||
|
| 'milestone'
|
||||||
|
| 'body'
|
||||||
|
| 'status'
|
||||||
|
| 'branch'
|
||||||
|
)[] = extractor.onProperty
|
||||||
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
||||||
for (let i = 0; i < list.length; i++) {
|
for (let i = 0; i < list.length; i++) {
|
||||||
const prop = list[i]
|
const prop = list[i]
|
||||||
let value: string = pr[prop]
|
let value: string | undefined = pr[prop]
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
core.warning(
|
core.warning(
|
||||||
`⚠️ the provided property '${extractor.onProperty}' for \`${extractor_usecase}\` is not valid`
|
`⚠️ the provided property '${extractor.onProperty}' for \`${extractor_usecase}\` is not valid`
|
||||||
@@ -514,7 +520,9 @@ function extractValuesFromString(
|
|||||||
export interface RegexTransformer {
|
export interface RegexTransformer {
|
||||||
pattern: RegExp | null
|
pattern: RegExp | null
|
||||||
target: string
|
target: string
|
||||||
onProperty?: ('title' | 'author' | 'milestone' | 'body')[] | undefined
|
onProperty?:
|
||||||
|
| ('title' | 'author' | 'milestone' | 'body' | 'status' | 'branch')[]
|
||||||
|
| undefined
|
||||||
method?: 'replace' | 'match' | undefined
|
method?: 'replace' | 'match' | undefined
|
||||||
onEmpty?: string | undefined
|
onEmpty?: string | undefined
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user