Merge pull request #1341 from mikepenz/feature/contributors
Introduce CONTRIBUTORS (PR author based)
This commit is contained in:
@@ -246,7 +246,7 @@ ${{steps.build_changelog.outputs.changelog}}
|
||||
A full set list of possible output values for this action.
|
||||
|
||||
| **Output** | **Description** |
|
||||
|-----------------------|---------------------------------------------------------------------------------------------------------------------------|
|
||||
|-----------------------------|---------------------------------------------------------------------------------------------------------------------------|
|
||||
| `outputs.changelog` | The built release changelog built from the merged pull requests |
|
||||
| `outputs.owner` | Specifies the owner of the repository processed |
|
||||
| `outputs.repo` | Describes the repository name, which was processed |
|
||||
@@ -262,6 +262,7 @@ A full set list of possible output values for this action.
|
||||
| `outputs.deletions` | Count of code deletions in this release (lines). |
|
||||
| `outputs.changes` | Total count of changes in this release (lines). |
|
||||
| `outputs.commits` | Count of commits which have been added in this release. |
|
||||
| `outputs.contributors` | The contributors of this release. Based on PR authors only. |
|
||||
| `outputs.categorized` | The categorized pull requests used to build the changelog as serialized JSON. |
|
||||
| `outputs.cache` | The file pointing to the cache for the current fetched data. Can be provided to another action step. |
|
||||
|
||||
@@ -461,6 +462,7 @@ Table of supported placeholders allowed to be used in the `template` and `empty_
|
||||
| `#{{DELETIONS}}` | The count of code deletions (lines). | |
|
||||
| `#{{CHANGES}}` | The count of total changes (lines). | |
|
||||
| `#{{COMMITS}}` | The count of commits in this release. | |
|
||||
| `#{{CONTRIBUTORS}}` | The contributors of this release. Based on PR Authors only. | |
|
||||
| `#{{CATEGORIZED_COUNT}}` | The count of PRs which were categorized | |
|
||||
| `#{{UNCATEGORIZED_COUNT}}` | The count of PRs and changes which were not categorized. No label overlapping with category labels | |
|
||||
| `#{{OPEN_COUNT}}` | The count of open PRs. Will only be fetched if `includeOpen` is configured. | |
|
||||
@@ -505,7 +507,7 @@ When using `*` values are joined by `,`.
|
||||
| `#{{REVIEWERS[*]}}` | GitHub Login names of specified reviewers. Requires `fetchReviewers` to be enabled. |
|
||||
| `#{{APPROVERS[*]}}` | GitHub Login names of users who approved the PR. |
|
||||
|
||||
Additionally there are special array placeholders like `REVIEWS` which allows access to it's properties via
|
||||
Additionally, there are special array placeholders like `REVIEWS` which allows access to it's properties via
|
||||
`(KEY)[(*/index)].(property)`.
|
||||
|
||||
For example: `REVIEWS[*].author` or `REVIEWS[*].body`
|
||||
@@ -579,7 +581,7 @@ Since v5.x or newer, the regex configuration was unified to allow the same funct
|
||||
This applies to all configurations outlined in `Configuration Specification` and `Custom placeholders` that allow a regex object.
|
||||
|
||||
| **Input** | **Description** |
|
||||
|-----------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| <parent>.pattern | The `regex` pattern to use |
|
||||
| <parent>.target | The result pattern. The result text will be used as label. If empty, no label is created. (Usage depends on the `method` used for the regex) |
|
||||
| <parent>.method | The extraction method used. Defaults to: `replace`. Alternative values: `replaceAll`, `match`. These methods specified references the JavaScript String method. And a special method `regexr`, that functions similar to the `list` within the regexr tool. |
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
"labels": ["dependencies"]
|
||||
}
|
||||
],
|
||||
"template": "${{CHANGELOG}}\n\nContributors:\n${{CONTRIBUTORS}}",
|
||||
"max_pull_requests": 1000,
|
||||
"max_back_track_time_days": 1000
|
||||
}
|
||||
+9
@@ -2786,12 +2786,21 @@ function buildChangelog(diffInfo, origPrs, options) {
|
||||
}
|
||||
}
|
||||
core.info(`✒️ Wrote ${ignoredPrs.length} ignored pull requests down`);
|
||||
// collect all contributors
|
||||
let contributors = [];
|
||||
for (const pr of prs) {
|
||||
contributors = contributors.concat(`@${pr.author}`);
|
||||
}
|
||||
const contributorsString = contributors.join(', ');
|
||||
core.setOutput('contributors', JSON.stringify(contributors));
|
||||
// fill template
|
||||
const placeholderMap = new Map();
|
||||
placeholderMap.set('CHANGELOG', changelog);
|
||||
placeholderMap.set('UNCATEGORIZED', changelogUncategorized);
|
||||
placeholderMap.set('OPEN', changelogOpen);
|
||||
placeholderMap.set('IGNORED', changelogIgnored);
|
||||
// fill special collected contributors
|
||||
placeholderMap.set('CONTRIBUTORS', contributorsString);
|
||||
// fill other placeholders
|
||||
placeholderMap.set('CATEGORIZED_COUNT', categorizedPrs.length.toString());
|
||||
placeholderMap.set('UNCATEGORIZED_COUNT', uncategorizedPrs.length.toString());
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -275,12 +275,22 @@ export function buildChangelog(diffInfo: DiffInfo, origPrs: PullRequestInfo[], o
|
||||
}
|
||||
core.info(`✒️ Wrote ${ignoredPrs.length} ignored pull requests down`)
|
||||
|
||||
// collect all contributors
|
||||
let contributors: string[] = []
|
||||
for (const pr of prs) {
|
||||
contributors = contributors.concat(`@${pr.author}`)
|
||||
}
|
||||
const contributorsString = contributors.join(', ')
|
||||
core.setOutput('contributors', JSON.stringify(contributors))
|
||||
|
||||
// fill template
|
||||
const placeholderMap = new Map<string, string>()
|
||||
placeholderMap.set('CHANGELOG', changelog)
|
||||
placeholderMap.set('UNCATEGORIZED', changelogUncategorized)
|
||||
placeholderMap.set('OPEN', changelogOpen)
|
||||
placeholderMap.set('IGNORED', changelogIgnored)
|
||||
// fill special collected contributors
|
||||
placeholderMap.set('CONTRIBUTORS', contributorsString)
|
||||
// fill other placeholders
|
||||
placeholderMap.set('CATEGORIZED_COUNT', categorizedPrs.length.toString())
|
||||
placeholderMap.set('UNCATEGORIZED_COUNT', uncategorizedPrs.length.toString())
|
||||
|
||||
Reference in New Issue
Block a user