- introduce proper configuration for fetchReviews

- drop no longer needed limiting of PRs
- retrieve state from PR review comment
This commit is contained in:
Mike Penz
2022-12-09 13:29:06 +00:00
committed by GitHub
parent 2fe056f840
commit 24f4e30f9f
12 changed files with 81 additions and 40 deletions
+2 -16
View File
@@ -1,6 +1,6 @@
import * as core from '@actions/core'
import {Category, DefaultConfiguration, Extractor, Placeholder, Transformer} from './configuration'
import {CommentInfo, PullRequestInfo, sortPullRequests} from './pullRequests'
import {CommentInfo, EMPTY_COMMENT_INFO, PullRequestInfo, sortPullRequests} from './pullRequests'
import {ReleaseNotesOptions} from './releaseNotes'
import {DiffInfo} from './commits'
import {createOrSet, haveCommonElements, haveEveryElements} from './utils'
@@ -47,13 +47,6 @@ export function buildChangelog(diffInfo: DiffInfo, prs: PullRequestInfo[], optio
}
}
// limit the PRs to the `max_pull_requests`
const max_pull_requests = config.max_pull_requests || DefaultConfiguration.max_pull_requests
if (prs.length > max_pull_requests) {
core.info(`️ Retrieved ${prs.length} PRs, limit count to: ${max_pull_requests} (max_pull_requests).`)
prs.length = Math.min(prs.length, max_pull_requests)
}
// extract additional labels from the commit message
const labelExtractors = validateTransformers(config.label_extractor)
for (const extractor of labelExtractors) {
@@ -400,14 +393,7 @@ function replaceReviewPlaceholders(template: string, parentKey: string, values:
let transformed = template
// retrieve the keys from the CommentInfo object
const comment: CommentInfo = {
id: 0,
htmlURL: '',
submittedAt: undefined,
author: '',
body: ''
}
for (const childKey of Object.keys(comment)) {
for (const childKey of Object.keys(EMPTY_COMMENT_INFO)) {
for (let i = 0; i < values.length; i++) {
transformed = transformed.replaceAll(
`\${{${parentKey}[${i}].${childKey}}}`,