Merge pull request #1361 from mikepenz/feature/1360
Introduce `AUTHOR_NAME` placeholder
This commit is contained in:
@@ -207,7 +207,7 @@ Depending on the use-case additional settings can be provided to the action
|
||||
> All input values are optional. It is only required to provide the `token` either via the input, or as `env` variable.
|
||||
|
||||
| **Input** | **Description** |
|
||||
|---------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
|---------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `configurationJson` | Provide the configuration directly via the build `yml` file. Please note that `${{}}` has to be written as `#{{}}` within the `yml` file. |
|
||||
| `configuration` | Relative path, to the `configuration.json` file, providing additional configurations |
|
||||
| `outputFile` | Optional relative path to a file to store the resulting changelog in. |
|
||||
@@ -467,7 +467,7 @@ Table of supported placeholders allowed to be used in the `template` and `empty_
|
||||
Table of supported placeholders allowed to be used in the `pr_template` configuration, which will be included in the release notes / changelog.
|
||||
|
||||
| **Placeholder** | **Description** |
|
||||
|-------------------|----------------------------------------------------------------------------------------------------|
|
||||
|--------------------|----------------------------------------------------------------------------------------------------|
|
||||
| `#{{NUMBER}}` | The number referencing this pull request. E.g. 13. |
|
||||
| `#{{TITLE}}` | Specified title of the merged pull request. |
|
||||
| `#{{URL}}` | Url linking to the pull request on GitHub. |
|
||||
@@ -476,6 +476,7 @@ Table of supported placeholders allowed to be used in the `pr_template` configur
|
||||
| `#{{MERGED_AT}}` | The ISO time, the pull request was merged at. |
|
||||
| `#{{MERGE_SHA}}` | The commit SHA, the pull request was merged with. |
|
||||
| `#{{AUTHOR}}` | Author creating and opening the pull request. |
|
||||
| `#{{AUTHOR_NAME}}` | The name of the Author creating and opening the pull request (Can be empty). |
|
||||
| `#{{LABELS}}` | The labels associated with this pull request, joined by `,`. |
|
||||
| `#{{MILESTONE}}` | Milestone this PR was part of, as assigned on GitHub. |
|
||||
| `#{{BODY}}` | Description/Body of the pull request as specified on GitHub. |
|
||||
|
||||
@@ -42,6 +42,7 @@ mergedPullRequests.push(
|
||||
mergedAt: moment(),
|
||||
mergeCommitSha: 'sha1',
|
||||
author: 'Mike',
|
||||
authorName: 'Mike',
|
||||
repoName: 'test-repo',
|
||||
labels: [],
|
||||
milestone: '',
|
||||
@@ -60,6 +61,7 @@ mergedPullRequests.push(
|
||||
mergedAt: moment(),
|
||||
mergeCommitSha: 'sha1',
|
||||
author: 'Mike',
|
||||
authorName: 'Mike',
|
||||
repoName: 'test-repo',
|
||||
labels: [],
|
||||
milestone: '',
|
||||
@@ -78,6 +80,7 @@ mergedPullRequests.push(
|
||||
mergedAt: moment(),
|
||||
mergeCommitSha: 'sha1',
|
||||
author: 'Mike',
|
||||
authorName: 'Mike',
|
||||
repoName: 'test-repo',
|
||||
labels: [],
|
||||
milestone: '',
|
||||
@@ -96,6 +99,7 @@ mergedPullRequests.push(
|
||||
mergedAt: moment(),
|
||||
mergeCommitSha: 'sha1',
|
||||
author: 'Mike',
|
||||
authorName: 'Mike',
|
||||
repoName: 'test-repo',
|
||||
labels: [],
|
||||
milestone: '',
|
||||
@@ -116,6 +120,7 @@ const pullRequestWithLabelInBody: PullRequestInfo = {
|
||||
mergedAt: moment(),
|
||||
mergeCommitSha: 'sha1',
|
||||
author: 'Mike',
|
||||
authorName: 'Mike',
|
||||
repoName: 'test-repo',
|
||||
labels: [],
|
||||
milestone: '',
|
||||
@@ -135,6 +140,7 @@ const openPullRequest: PullRequestInfo = {
|
||||
mergedAt: moment(),
|
||||
mergeCommitSha: 'sha1',
|
||||
author: 'Mike',
|
||||
authorName: 'Mike',
|
||||
repoName: 'test-repo',
|
||||
labels: [],
|
||||
milestone: '',
|
||||
@@ -249,6 +255,7 @@ pullRequestsWithLabels.push(
|
||||
mergedAt: moment(),
|
||||
mergeCommitSha: 'sha1-1',
|
||||
author: 'Mike',
|
||||
authorName: 'Mike',
|
||||
repoName: 'test-repo',
|
||||
labels: ['feature'],
|
||||
milestone: '',
|
||||
@@ -267,6 +274,7 @@ pullRequestsWithLabels.push(
|
||||
mergedAt: moment(),
|
||||
mergeCommitSha: 'sha1-2',
|
||||
author: 'Mike',
|
||||
authorName: 'Mike',
|
||||
repoName: 'test-repo',
|
||||
labels: ['issue', 'fix'],
|
||||
milestone: '',
|
||||
@@ -285,6 +293,7 @@ pullRequestsWithLabels.push(
|
||||
mergedAt: moment().add(1, 'days'),
|
||||
mergeCommitSha: 'sha1-3',
|
||||
author: 'Mike',
|
||||
authorName: 'Mike',
|
||||
repoName: 'test-repo',
|
||||
labels: ['issue', 'feature', 'fix'],
|
||||
milestone: '',
|
||||
@@ -303,6 +312,7 @@ pullRequestsWithLabels.push(
|
||||
mergedAt: moment(),
|
||||
mergeCommitSha: 'sha1-4',
|
||||
author: 'Mike',
|
||||
authorName: 'Mike',
|
||||
repoName: 'test-repo',
|
||||
labels: [''],
|
||||
milestone: '',
|
||||
@@ -325,6 +335,7 @@ openPullRequestsWithLabels.push(
|
||||
mergedAt: moment(),
|
||||
mergeCommitSha: 'sha1',
|
||||
author: 'Mike',
|
||||
authorName: 'Mike',
|
||||
repoName: 'test-repo',
|
||||
labels: ['feature'],
|
||||
milestone: '',
|
||||
@@ -343,6 +354,7 @@ openPullRequestsWithLabels.push(
|
||||
mergedAt: moment(),
|
||||
mergeCommitSha: 'sha1',
|
||||
author: 'Mike',
|
||||
authorName: 'Mike',
|
||||
repoName: 'test-repo',
|
||||
labels: [],
|
||||
milestone: '',
|
||||
|
||||
@@ -32,6 +32,7 @@ export const buildPullRequeset = (number: number, title: string, labels: string[
|
||||
mergedAt: moment(),
|
||||
mergeCommitSha: 'sha',
|
||||
author: 'Author',
|
||||
authorName: 'Author',
|
||||
repoName: 'test-repo',
|
||||
labels,
|
||||
milestone: '',
|
||||
|
||||
+24
-15
@@ -360,6 +360,7 @@ function convertCommitsToPrs(options, diffInfo) {
|
||||
mergedAt: commit.commitDate,
|
||||
mergeCommitSha: commit.sha,
|
||||
author: commit.author || '',
|
||||
authorName: commit.authorName || '',
|
||||
repoName: '',
|
||||
labels: [],
|
||||
milestone: '',
|
||||
@@ -725,6 +726,7 @@ exports.EMPTY_PULL_REQUEST_INFO = {
|
||||
createdAt: (0, moment_1.default)(),
|
||||
mergeCommitSha: '',
|
||||
author: '',
|
||||
authorName: '',
|
||||
repoName: '',
|
||||
labels: [],
|
||||
milestone: '',
|
||||
@@ -1931,7 +1933,7 @@ class GiteaRepository extends BaseRepository_1.BaseRepository {
|
||||
});
|
||||
}
|
||||
mapPullRequest(pr, status = 'open') {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
||||
return {
|
||||
number: pr.number || 0,
|
||||
title: pr.title || '',
|
||||
@@ -1941,12 +1943,13 @@ class GiteaRepository extends BaseRepository_1.BaseRepository {
|
||||
mergedAt: pr.merged_at ? (0, moment_1.default)(pr.merged_at) : undefined,
|
||||
mergeCommitSha: pr.merge_commit_sha || '',
|
||||
author: ((_c = pr.user) === null || _c === void 0 ? void 0 : _c.login) || '',
|
||||
repoName: ((_e = (_d = pr.base) === null || _d === void 0 ? void 0 : _d.repo) === null || _e === void 0 ? void 0 : _e.full_name) || '',
|
||||
labels: (_f = pr.labels) === null || _f === void 0 ? void 0 : _f.map(label => { var _a; return (_a = label.name) === null || _a === void 0 ? void 0 : _a.toLowerCase(); }),
|
||||
milestone: ((_g = pr.milestone) === null || _g === void 0 ? void 0 : _g.title) || '',
|
||||
authorName: ((_d = pr.user) === null || _d === void 0 ? void 0 : _d.full_name) || '',
|
||||
repoName: ((_f = (_e = pr.base) === null || _e === void 0 ? void 0 : _e.repo) === null || _f === void 0 ? void 0 : _f.full_name) || '',
|
||||
labels: (_g = pr.labels) === null || _g === void 0 ? void 0 : _g.map(label => { var _a; return (_a = label.name) === null || _a === void 0 ? void 0 : _a.toLowerCase(); }),
|
||||
milestone: ((_h = pr.milestone) === null || _h === void 0 ? void 0 : _h.title) || '',
|
||||
body: pr.body || '',
|
||||
assignees: (_h = pr.assignees) === null || _h === void 0 ? void 0 : _h.map(user => user.full_name),
|
||||
requestedReviewers: (_j = pr.requested_reviewers) === null || _j === void 0 ? void 0 : _j.map(user => user.full_name),
|
||||
assignees: (_j = pr.assignees) === null || _j === void 0 ? void 0 : _j.map(user => user.full_name),
|
||||
requestedReviewers: (_k = pr.requested_reviewers) === null || _k === void 0 ? void 0 : _k.map(user => user.full_name),
|
||||
approvedReviewers: [],
|
||||
createdAt: (0, moment_1.default)(pr.created_at),
|
||||
status,
|
||||
@@ -1995,8 +1998,10 @@ class GiteaRepository extends BaseRepository_1.BaseRepository {
|
||||
summary: subject,
|
||||
message: '', // This would require another git command to get the full message if needed
|
||||
author: authorName,
|
||||
authorName,
|
||||
authorDate: (0, moment_1.default)(authorDate, 'ddd MMM DD HH:mm:ss YYYY ZZ', false),
|
||||
committer: committerName,
|
||||
committerName,
|
||||
commitDate: (0, moment_1.default)(committerDate, 'ddd MMM DD HH:mm:ss YYYY ZZ', false),
|
||||
prNumber: undefined // This is not available directly from git, would require additional logic to associate commits with PRs
|
||||
};
|
||||
@@ -2210,15 +2215,17 @@ class GithubRepository extends BaseRepository_1.BaseRepository {
|
||||
commitInfo: commits
|
||||
.filter(commit => commit.sha)
|
||||
.map(commit => {
|
||||
var _a, _b, _c, _d, _e;
|
||||
var _a, _b, _c, _d, _e, _f, _g;
|
||||
return ({
|
||||
sha: commit.sha || '',
|
||||
summary: commit.commit.message.split('\n')[0],
|
||||
message: commit.commit.message,
|
||||
author: ((_a = commit.author) === null || _a === void 0 ? void 0 : _a.login) || ((_b = commit.commit.author) === null || _b === void 0 ? void 0 : _b.name) || '',
|
||||
authorDate: (0, moment_1.default)((_c = commit.commit.author) === null || _c === void 0 ? void 0 : _c.date),
|
||||
committer: ((_d = commit.committer) === null || _d === void 0 ? void 0 : _d.login) || '',
|
||||
commitDate: (0, moment_1.default)((_e = commit.commit.committer) === null || _e === void 0 ? void 0 : _e.date),
|
||||
authorName: ((_c = commit.commit.author) === null || _c === void 0 ? void 0 : _c.name) || '',
|
||||
authorDate: (0, moment_1.default)((_d = commit.commit.author) === null || _d === void 0 ? void 0 : _d.date),
|
||||
committer: ((_e = commit.committer) === null || _e === void 0 ? void 0 : _e.login) || '',
|
||||
committerName: ((_f = commit.committer) === null || _f === void 0 ? void 0 : _f.name) || '',
|
||||
commitDate: (0, moment_1.default)((_g = commit.commit.committer) === null || _g === void 0 ? void 0 : _g.date),
|
||||
prNumber: undefined
|
||||
});
|
||||
})
|
||||
@@ -2385,7 +2392,7 @@ class GithubRepository extends BaseRepository_1.BaseRepository {
|
||||
constructor(token, url, repositoryPath) {
|
||||
super(token, url, repositoryPath);
|
||||
this.mapPullRequest = (pr, status = 'open') => {
|
||||
var _a, _b, _c, _d, _e;
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
return ({
|
||||
number: pr.number,
|
||||
title: pr.title,
|
||||
@@ -2396,12 +2403,13 @@ class GithubRepository extends BaseRepository_1.BaseRepository {
|
||||
mergedAt: pr.merged_at ? (0, moment_1.default)(pr.merged_at) : undefined,
|
||||
mergeCommitSha: pr.merge_commit_sha || '',
|
||||
author: ((_a = pr.user) === null || _a === void 0 ? void 0 : _a.login) || '',
|
||||
authorName: ((_b = pr.user) === null || _b === void 0 ? void 0 : _b.name) || '',
|
||||
repoName: pr.base.repo.full_name,
|
||||
labels: this.attachSpecialLabels(status, ((_b = pr.labels) === null || _b === void 0 ? void 0 : _b.map(lbl => { var _a; return ((_a = lbl.name) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase('en')) || ''; })) || []),
|
||||
milestone: ((_c = pr.milestone) === null || _c === void 0 ? void 0 : _c.title) || '',
|
||||
labels: this.attachSpecialLabels(status, ((_c = pr.labels) === null || _c === void 0 ? void 0 : _c.map(lbl => { var _a; return ((_a = lbl.name) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase('en')) || ''; })) || []),
|
||||
milestone: ((_d = pr.milestone) === null || _d === void 0 ? void 0 : _d.title) || '',
|
||||
body: pr.body || '',
|
||||
assignees: ((_d = pr.assignees) === null || _d === void 0 ? void 0 : _d.map(assignee => (assignee === null || assignee === void 0 ? void 0 : assignee.login) || '')) || [],
|
||||
requestedReviewers: ((_e = pr.requested_reviewers) === null || _e === void 0 ? void 0 : _e.map(reviewer => (reviewer === null || reviewer === void 0 ? void 0 : reviewer.login) || '')) || [],
|
||||
assignees: ((_e = pr.assignees) === null || _e === void 0 ? void 0 : _e.map(assignee => (assignee === null || assignee === void 0 ? void 0 : assignee.login) || '')) || [],
|
||||
requestedReviewers: ((_f = pr.requested_reviewers) === null || _f === void 0 ? void 0 : _f.map(reviewer => (reviewer === null || reviewer === void 0 ? void 0 : reviewer.login) || '')) || [],
|
||||
approvedReviewers: [],
|
||||
reviews: undefined,
|
||||
status
|
||||
@@ -2949,6 +2957,7 @@ function fillPrTemplate(pr, template, placeholders /* placeholders to apply */,
|
||||
placeholderMap.set('MERGED_AT', ((_a = pr.mergedAt) === null || _a === void 0 ? void 0 : _a.toISOString()) || '');
|
||||
placeholderMap.set('MERGE_SHA', pr.mergeCommitSha);
|
||||
placeholderMap.set('AUTHOR', pr.author);
|
||||
placeholderMap.set('AUTHOR_NAME', pr.authorName || '');
|
||||
placeholderMap.set('LABELS', ((_c = (_b = [...pr.labels]) === null || _b === void 0 ? void 0 : _b.filter(l => !l.startsWith('--rcba-'))) === null || _c === void 0 ? void 0 : _c.join(', ')) || '');
|
||||
placeholderMap.set('MILESTONE', pr.milestone || '');
|
||||
placeholderMap.set('BODY', pr.body);
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -28,8 +28,10 @@ export interface CommitInfo {
|
||||
summary: string
|
||||
message: string
|
||||
author: string
|
||||
authorName: string
|
||||
authorDate: moment.Moment
|
||||
committer: string
|
||||
committerName: string
|
||||
commitDate: moment.Moment
|
||||
}
|
||||
|
||||
@@ -117,6 +119,7 @@ export function convertCommitsToPrs(options: Options, diffInfo: DiffInfo): [Diff
|
||||
mergedAt: commit.commitDate,
|
||||
mergeCommitSha: commit.sha,
|
||||
author: commit.author || '',
|
||||
authorName: commit.authorName || '',
|
||||
repoName: '',
|
||||
labels: [],
|
||||
milestone: '',
|
||||
|
||||
@@ -16,6 +16,7 @@ export interface PullRequestInfo {
|
||||
mergedAt: moment.Moment | undefined
|
||||
mergeCommitSha: string
|
||||
author: string
|
||||
authorName: string
|
||||
repoName: string
|
||||
labels: string[]
|
||||
milestone: string
|
||||
@@ -45,6 +46,7 @@ export const EMPTY_PULL_REQUEST_INFO: PullRequestInfo = {
|
||||
createdAt: moment(),
|
||||
mergeCommitSha: '',
|
||||
author: '',
|
||||
authorName: '',
|
||||
repoName: '',
|
||||
labels: [],
|
||||
milestone: '',
|
||||
|
||||
@@ -73,6 +73,7 @@ export class GiteaRepository extends BaseRepository {
|
||||
mergedAt: pr.merged_at ? moment(pr.merged_at) : undefined,
|
||||
mergeCommitSha: pr.merge_commit_sha || '',
|
||||
author: pr.user?.login || '',
|
||||
authorName: pr.user?.full_name || '',
|
||||
repoName: pr.base?.repo?.full_name || '',
|
||||
labels: pr.labels?.map(label => label.name?.toLowerCase()) as string[],
|
||||
milestone: pr.milestone?.title || '',
|
||||
@@ -134,8 +135,10 @@ export class GiteaRepository extends BaseRepository {
|
||||
summary: subject,
|
||||
message: '', // This would require another git command to get the full message if needed
|
||||
author: authorName,
|
||||
authorName,
|
||||
authorDate: moment(authorDate, 'ddd MMM DD HH:mm:ss YYYY ZZ', false),
|
||||
committer: committerName,
|
||||
committerName,
|
||||
commitDate: moment(committerDate, 'ddd MMM DD HH:mm:ss YYYY ZZ', false),
|
||||
prNumber: undefined // This is not available directly from git, would require additional logic to associate commits with PRs
|
||||
}
|
||||
|
||||
@@ -60,8 +60,10 @@ export class GithubRepository extends BaseRepository {
|
||||
summary: commit.commit.message.split('\n')[0],
|
||||
message: commit.commit.message,
|
||||
author: commit.author?.login || commit.commit.author?.name || '',
|
||||
authorName: commit.commit.author?.name || '',
|
||||
authorDate: moment(commit.commit.author?.date),
|
||||
committer: commit.committer?.login || '',
|
||||
committerName: commit.committer?.name || '',
|
||||
commitDate: moment(commit.commit.committer?.date),
|
||||
prNumber: undefined
|
||||
}))
|
||||
@@ -269,6 +271,7 @@ export class GithubRepository extends BaseRepository {
|
||||
mergedAt: pr.merged_at ? moment(pr.merged_at) : undefined,
|
||||
mergeCommitSha: pr.merge_commit_sha || '',
|
||||
author: pr.user?.login || '',
|
||||
authorName: pr.user?.name || '',
|
||||
repoName: pr.base.repo.full_name,
|
||||
labels: this.attachSpecialLabels(status, pr.labels?.map(lbl => lbl.name?.toLocaleLowerCase('en') || '') || []),
|
||||
milestone: pr.milestone?.title || '',
|
||||
|
||||
@@ -472,6 +472,7 @@ function fillPrTemplate(
|
||||
placeholderMap.set('MERGED_AT', pr.mergedAt?.toISOString() || '')
|
||||
placeholderMap.set('MERGE_SHA', pr.mergeCommitSha)
|
||||
placeholderMap.set('AUTHOR', pr.author)
|
||||
placeholderMap.set('AUTHOR_NAME', pr.authorName || '')
|
||||
placeholderMap.set('LABELS', [...pr.labels]?.filter(l => !l.startsWith('--rcba-'))?.join(', ') || '')
|
||||
placeholderMap.set('MILESTONE', pr.milestone || '')
|
||||
placeholderMap.set('BODY', pr.body)
|
||||
|
||||
Reference in New Issue
Block a user