Skip to content

Commit

Permalink
Merge pull request #1343 from mikepenz/feature/contributors
Browse files Browse the repository at this point in the history
Enhance CONTRIBUTORS template
  • Loading branch information
mikepenz authored Jun 23, 2024
2 parents 8c644a1 + 09758f3 commit bbbdb7a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
11 changes: 7 additions & 4 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>()
Expand All @@ -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())
Expand Down

0 comments on commit bbbdb7a

Please sign in to comment.