Merge pull request #1343 from mikepenz/feature/contributors

Enhance CONTRIBUTORS template
This commit is contained in:
Mike Penz
2024-06-23 08:48:36 +02:00
committed by GitHub
3 changed files with 15 additions and 9 deletions
Generated Vendored
+7 -4
View File
@@ -2787,12 +2787,14 @@ function buildChangelog(diffInfo, origPrs, options) {
}
core.info(`✒️ Wrote ${ignoredPrs.length} ignored pull requests down`);
// collect all contributors
let contributors = [];
const contributorsSet = new Set();
for (const pr of prs) {
contributors = contributors.concat(`@${pr.author}`);
contributorsSet.add(`@${pr.author}`);
}
const contributorsString = contributors.join(', ');
core.setOutput('contributors', JSON.stringify(contributors));
const contributorsArray = Array.from(contributorsSet);
const contributorsString = contributorsArray.join(', ');
const externalContributorString = contributorsArray.filter(value => value !== options.owner).join(', ');
core.setOutput('contributors', JSON.stringify(contributorsSet));
// fill template
const placeholderMap = new Map();
placeholderMap.set('CHANGELOG', changelog);
@@ -2801,6 +2803,7 @@ function buildChangelog(diffInfo, origPrs, options) {
placeholderMap.set('IGNORED', changelogIgnored);
// fill special collected contributors
placeholderMap.set('CONTRIBUTORS', contributorsString);
placeholderMap.set('EXTERNAL_CONTRIBUTORS', externalContributorString);
// fill other placeholders
placeholderMap.set('CATEGORIZED_COUNT', categorizedPrs.length.toString());
placeholderMap.set('UNCATEGORIZED_COUNT', uncategorizedPrs.length.toString());
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+7 -4
View File
@@ -276,12 +276,14 @@ export function buildChangelog(diffInfo: DiffInfo, origPrs: PullRequestInfo[], o
core.info(`✒️ Wrote ${ignoredPrs.length} ignored pull requests down`)
// collect all contributors
let contributors: string[] = []
const contributorsSet: Set<String> = new Set()
for (const pr of prs) {
contributors = contributors.concat(`@${pr.author}`)
contributorsSet.add(`@${pr.author}`)
}
const contributorsString = contributors.join(', ')
core.setOutput('contributors', JSON.stringify(contributors))
const contributorsArray = Array.from(contributorsSet)
const contributorsString = contributorsArray.join(', ')
const externalContributorString = contributorsArray.filter(value => value !== options.owner).join(', ')
core.setOutput('contributors', JSON.stringify(contributorsSet))
// fill template
const placeholderMap = new Map<string, string>()
@@ -291,6 +293,7 @@ export function buildChangelog(diffInfo: DiffInfo, origPrs: PullRequestInfo[], o
placeholderMap.set('IGNORED', changelogIgnored)
// fill special collected contributors
placeholderMap.set('CONTRIBUTORS', contributorsString)
placeholderMap.set('EXTERNAL_CONTRIBUTORS', externalContributorString)
// fill other placeholders
placeholderMap.set('CATEGORIZED_COUNT', categorizedPrs.length.toString())
placeholderMap.set('UNCATEGORIZED_COUNT', uncategorizedPrs.length.toString())