- introduce new placeholder for AUTHOR_NAME

- FIX https://github.com/mikepenz/release-changelog-builder-action/issues/1360
This commit is contained in:
Mike Penz
2024-08-07 14:54:02 +02:00
parent f968a8466a
commit f43925498a
8 changed files with 134 additions and 122 deletions
+40 -39
View File
@@ -206,29 +206,29 @@ Depending on the use-case additional settings can be provided to the action
> [!NOTE]
> 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. |
| `owner` | The owner of the repository to generate the changelog for |
| `repo` | Name of the repository we want to process |
| `fromTag` | Defines the 'start' from where the changelog will consider merged pull requests (can be a tag or a valid git ref) |
| `toTag` | Defines until which tag the changelog will consider merged pull requests (can be a tag or a valid git ref) |
| `path` | Allows to specify an alternative sub directory, to use as base |
| `token` | Alternative config to specify token. You should prefer `env.GITHUB_TOKEN` instead though |
| `baseUrl` | Alternative config to specify base url for GitHub Enterprise authentication. Default value set to `https://api.github.com` |
| `includeOpen` | Enables to also fetch currently open PRs. Default: false |
| `ignorePreReleases` | Allows to ignore pre-releases for changelog generation (E.g. for 1.0.1... 1.0.0-rc02 <- ignore, 1.0.0 <- pick). Only used if `fromTag` was not specified. Default: false |
| `failOnError` | Defines if the action will result in a build failure if problems occurred. Default: false |
| `fetchViaCommits` | Enables PRs to get fetched via the commits identified between from->to tag. This will do 1 API request per commit -> Best for scenarios with squash merges | Or shorter from->to diffs (< 10 commits) | Also effective for shorters diffs for very old PRs. Default: false |
| `fetchReviewers` | Will enable fetching the users/reviewers who approved the PR. Default: false |
| `fetchReleaseInformation` | Will enable fetching additional release information from tags. Default: false |
| `fetchReviews` | Will enable fetching the reviews on of the PR. Default: false |
| `mode` | Defines the mode used to retrieve the information. Available options: [`PR`, `COMMIT`, `HYBRID`]. Defaults to `PR`. Hybrid mode treats commits like pull requests. Commit mode is a special configuration for projects which work without PRs. Uses commit messages as changelog. This mode looses access to information only available for PRs. Formerly set as `commitMode: true`, this setting is now deprecated and should be converted to `mode: "COMMIT"`. Note: the commit or hybrid modes are not fully supported. |
| `exportCache` | Will enable exporting the fetched PR information to a cache, which can be re-used by later runs. Default: false |
| `exportOnly` | When enabled, will result in only exporting the cache, without generating a changelog. Default: false (Requires `exportCache` to be enabled) |
| `cache` | The file path to write/read the cache to/from. |
| **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. |
| `owner` | The owner of the repository to generate the changelog for |
| `repo` | Name of the repository we want to process |
| `fromTag` | Defines the 'start' from where the changelog will consider merged pull requests (can be a tag or a valid git ref) |
| `toTag` | Defines until which tag the changelog will consider merged pull requests (can be a tag or a valid git ref) |
| `path` | Allows to specify an alternative sub directory, to use as base |
| `token` | Alternative config to specify token. You should prefer `env.GITHUB_TOKEN` instead though |
| `baseUrl` | Alternative config to specify base url for GitHub Enterprise authentication. Default value set to `https://api.github.com` |
| `includeOpen` | Enables to also fetch currently open PRs. Default: false |
| `ignorePreReleases` | Allows to ignore pre-releases for changelog generation (E.g. for 1.0.1... 1.0.0-rc02 <- ignore, 1.0.0 <- pick). Only used if `fromTag` was not specified. Default: false |
| `failOnError` | Defines if the action will result in a build failure if problems occurred. Default: false |
| `fetchViaCommits` | Enables PRs to get fetched via the commits identified between from->to tag. This will do 1 API request per commit -> Best for scenarios with squash merges | Or shorter from->to diffs (< 10 commits) | Also effective for shorters diffs for very old PRs. Default: false |
| `fetchReviewers` | Will enable fetching the users/reviewers who approved the PR. Default: false |
| `fetchReleaseInformation` | Will enable fetching additional release information from tags. Default: false |
| `fetchReviews` | Will enable fetching the reviews on of the PR. Default: false |
| `mode` | Defines the mode used to retrieve the information. Available options: [`PR`, `COMMIT`, `HYBRID`]. Defaults to `PR`. Hybrid mode treats commits like pull requests. Commit mode is a special configuration for projects which work without PRs. Uses commit messages as changelog. This mode looses access to information only available for PRs. Formerly set as `commitMode: true`, this setting is now deprecated and should be converted to `mode: "COMMIT"`. Note: the commit or hybrid modes are not fully supported. |
| `exportCache` | Will enable exporting the fetched PR information to a cache, which can be re-used by later runs. Default: false |
| `exportOnly` | When enabled, will result in only exporting the cache, without generating a changelog. Default: false (Requires `exportCache` to be enabled) |
| `cache` | The file path to write/read the cache to/from. |
> [!WARNING]
> `${{ secrets.GITHUB_TOKEN }}` only grants rights to the current repository, for other repositories please use a PAT (Personal Access Token).
@@ -466,22 +466,23 @@ 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. |
| `#{{STATUS}}` | Status of the PR. Usually always `merged`. Possibly `Open` if `includeOpen` is configured. |
| `#{{CREATED_AT}}` | The ISO time, the pull request was created at. |
| `#{{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. |
| `#{{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. |
| `#{{ASSIGNEES}}` | Login names of assigned GitHub users, joined by `,`. |
| `#{{REVIEWERS}}` | GitHub Login names of specified reviewers, joined by `,`. Requires `fetchReviewers` to be enabled. |
| `#{{APPROVERS}}` | GitHub Login names of users who approved the PR, joined by `,`. |
| **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. |
| `#{{STATUS}}` | Status of the PR. Usually always `merged`. Possibly `Open` if `includeOpen` is configured. |
| `#{{CREATED_AT}}` | The ISO time, the pull request was created at. |
| `#{{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. |
| `#{{ASSIGNEES}}` | Login names of assigned GitHub users, joined by `,`. |
| `#{{REVIEWERS}}` | GitHub Login names of specified reviewers, joined by `,`. Requires `fetchReviewers` to be enabled. |
| `#{{APPROVERS}}` | GitHub Login names of users who approved the PR, joined by `,`. |
> [!IMPORTANT]
> `v4` updates the default placeholders format to `#{{}}`. The old format `${{}}` will be supported until v5 for backwards compatibility.
Generated Vendored
+81 -82
View File
@@ -264,9 +264,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Commits = exports.DefaultDiffInfo = void 0;
exports.convertCommitsToPrs = convertCommitsToPrs;
exports.filterCommits = filterCommits;
exports.filterCommits = exports.convertCommitsToPrs = exports.Commits = exports.DefaultDiffInfo = void 0;
const core = __importStar(__nccwpck_require__(2186));
const utils_1 = __nccwpck_require__(9613);
exports.DefaultDiffInfo = {
@@ -360,6 +358,7 @@ function convertCommitsToPrs(options, diffInfo) {
mergedAt: commit.commitDate,
mergeCommitSha: commit.sha,
author: commit.author || '',
authorName: commit.authorName || '',
repoName: '',
labels: [],
milestone: '',
@@ -372,6 +371,7 @@ function convertCommitsToPrs(options, diffInfo) {
});
return [diffInfo, prs];
}
exports.convertCommitsToPrs = convertCommitsToPrs;
/**
* Filters out all commits which match the exclude pattern
*/
@@ -394,6 +394,7 @@ function filterCommits(commits, excludeMergeBranches) {
}
return filteredCommits;
}
exports.filterCommits = filterCommits;
/***/ }),
@@ -436,7 +437,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.createCommandManager = createCommandManager;
exports.createCommandManager = void 0;
const exec = __importStar(__nccwpck_require__(1514));
const io = __importStar(__nccwpck_require__(7436));
const utils_1 = __nccwpck_require__(9613);
@@ -445,6 +446,7 @@ function createCommandManager(workingDirectory) {
return yield GitCommandManager.createCommandManager(workingDirectory);
});
}
exports.createCommandManager = createCommandManager;
class GitCommandManager {
// Private constructor; use createCommandManager()
constructor() {
@@ -555,8 +557,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.PullRequestCollector = void 0;
exports.pullData = pullData;
exports.pullData = exports.PullRequestCollector = void 0;
const core = __importStar(__nccwpck_require__(2186));
const tags_1 = __nccwpck_require__(6906);
const utils_1 = __nccwpck_require__(9613);
@@ -664,6 +665,7 @@ function pullData(repositoryUtils, options) {
};
});
}
exports.pullData = pullData;
/***/ }),
@@ -709,10 +711,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.PullRequests = exports.EMPTY_COMMENT_INFO = exports.EMPTY_PULL_REQUEST_INFO = void 0;
exports.sortPullRequests = sortPullRequests;
exports.compare = compare;
exports.retrieveProperty = retrieveProperty;
exports.retrieveProperty = exports.compare = exports.sortPullRequests = exports.PullRequests = exports.EMPTY_COMMENT_INFO = exports.EMPTY_PULL_REQUEST_INFO = void 0;
const core = __importStar(__nccwpck_require__(2186));
const moment_1 = __importDefault(__nccwpck_require__(9623));
const commits_1 = __nccwpck_require__(234);
@@ -725,6 +724,7 @@ exports.EMPTY_PULL_REQUEST_INFO = {
createdAt: (0, moment_1.default)(),
mergeCommitSha: '',
author: '',
authorName: '',
repoName: '',
labels: [],
milestone: '',
@@ -904,6 +904,7 @@ function sortPullRequests(pullRequests, sort) {
}
return pullRequests;
}
exports.sortPullRequests = sortPullRequests;
function compare(a, b, sort) {
if (sort.on_property === 'mergedAt') {
const aa = a.mergedAt || a.createdAt;
@@ -921,6 +922,7 @@ function compare(a, b, sort) {
return a.title.localeCompare(b.title);
}
}
exports.compare = compare;
/**
* Helper function to retrieve a property from the PullRequestInfo
*/
@@ -941,6 +943,7 @@ function retrieveProperty(pr, property, useCase) {
}
return value;
}
exports.retrieveProperty = retrieveProperty;
/***/ }),
@@ -974,11 +977,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.validateRegex = validateRegex;
exports.buildRegex = buildRegex;
exports.transformStringToValues = transformStringToValues;
exports.transformStringToOptionalValue = transformStringToOptionalValue;
exports.transformStringToValue = transformStringToValue;
exports.transformStringToValue = exports.transformStringToOptionalValue = exports.transformStringToValues = exports.buildRegex = exports.validateRegex = void 0;
const core = __importStar(__nccwpck_require__(2186));
function validateRegex(regex) {
if (regex === undefined) {
@@ -1005,6 +1004,7 @@ function validateRegex(regex) {
return null;
}
}
exports.validateRegex = validateRegex;
/**
* Constructs the RegExp, providing the configured Regex and additional values
*/
@@ -1024,6 +1024,7 @@ function buildRegex(regex, target, onProperty, method, onEmpty) {
return null;
}
}
exports.buildRegex = buildRegex;
function transformStringToValues(value, extractor) {
if (extractor.pattern == null) {
return null;
@@ -1057,6 +1058,7 @@ function transformStringToValues(value, extractor) {
}
return null;
}
exports.transformStringToValues = transformStringToValues;
function transformStringToOptionalValue(value, extractor) {
const result = transformStringToValues(value, extractor);
if (result != null && result.length > 0) {
@@ -1066,9 +1068,11 @@ function transformStringToOptionalValue(value, extractor) {
return null;
}
}
exports.transformStringToOptionalValue = transformStringToOptionalValue;
function transformStringToValue(value, extractor) {
return transformStringToOptionalValue(value, extractor) || '';
}
exports.transformStringToValue = transformStringToValue;
function transformRegexr(regex, source, target) {
/**
* Util function extracted from regexr and is licensed under:
@@ -1143,10 +1147,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Tags = void 0;
exports.filterTags = filterTags;
exports.transformTags = transformTags;
exports.prepareAndSortTags = prepareAndSortTags;
exports.prepareAndSortTags = exports.transformTags = exports.filterTags = exports.Tags = void 0;
const core = __importStar(__nccwpck_require__(2186));
const github = __importStar(__nccwpck_require__(5438));
const semver = __importStar(__nccwpck_require__(1383));
@@ -1323,6 +1324,7 @@ function filterTags(tags, filterRegex) {
return tags;
}
}
exports.filterTags = filterTags;
/**
* Helper function to transform the tag name given the transformer
*/
@@ -1342,6 +1344,7 @@ function transformTags(tags, transformer) {
}
});
}
exports.transformTags = transformTags;
/*
Sorts an array of tags as shown below:
@@ -1365,6 +1368,7 @@ function prepareAndSortTags(tags, tagResolver) {
return semVerTags(tags);
}
}
exports.prepareAndSortTags = prepareAndSortTags;
function semVerTags(tags) {
// filter out tags which do not follow semver
const validatedTags = tags.filter(tag => {
@@ -1448,8 +1452,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.failOrError = failOrError;
exports.directoryExistsSync = directoryExistsSync;
exports.directoryExistsSync = exports.failOrError = void 0;
const core = __importStar(__nccwpck_require__(2186));
const fs = __importStar(__nccwpck_require__(7147));
/**
@@ -1465,6 +1468,7 @@ function failOrError(message, failOnError) {
core.error(message);
}
}
exports.failOrError = failOrError;
/**
* Checks if a given directory exists
*/
@@ -1493,6 +1497,7 @@ function directoryExistsSync(inputPath, required) {
}
throw new Error(`Directory '${inputPath}' does not exist`);
}
exports.directoryExistsSync = directoryExistsSync;
/***/ }),
@@ -1526,7 +1531,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.matchesRules = matchesRules;
exports.matchesRules = void 0;
const core = __importStar(__nccwpck_require__(2186));
const pullRequests_1 = __nccwpck_require__(4012);
const regexUtils_1 = __nccwpck_require__(5351);
@@ -1546,6 +1551,7 @@ function matchesRules(rules, pr, exhaustive) {
});
}
}
exports.matchesRules = matchesRules;
/**
* Checks if the configured property results in a positive `test` with the regex.
*/
@@ -1931,7 +1937,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 +1947,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 +2002,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 +2219,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 +2396,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 +2407,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
@@ -2549,9 +2561,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.clear = clear;
exports.buildChangelog = buildChangelog;
exports.replaceEmptyTemplate = replaceEmptyTemplate;
exports.replaceEmptyTemplate = exports.buildChangelog = exports.clear = void 0;
const core = __importStar(__nccwpck_require__(2186));
const utils_1 = __nccwpck_require__(918);
const pullRequests_1 = __nccwpck_require__(4012);
@@ -2562,6 +2572,7 @@ let CLEAR = false;
function clear() {
CLEAR = true;
}
exports.clear = clear;
function buildChangelog(diffInfo, origPrs, options) {
core.startGroup('📦 Build changelog');
let prs = origPrs;
@@ -2822,6 +2833,7 @@ function buildChangelog(diffInfo, origPrs, options) {
core.endGroup();
return transformedChangelog;
}
exports.buildChangelog = buildChangelog;
function recursiveCategorizePr(category, pr, body) {
let matched = false;
let consumed = false;
@@ -2917,6 +2929,7 @@ function replaceEmptyTemplate(template, options) {
fillAdditionalPlaceholders(options, placeholderMap);
return replacePlaceholders(template, EMPTY_MAP, placeholderMap, placeholders, undefined, options.configuration);
}
exports.replaceEmptyTemplate = replaceEmptyTemplate;
function fillAdditionalPlaceholders(options, placeholderMap /* placeholderKey and original value */) {
var _a, _b;
placeholderMap.set('OWNER', options.owner);
@@ -2949,6 +2962,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);
@@ -3173,19 +3187,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.retrieveRepositoryPath = retrieveRepositoryPath;
exports.writeCacheData = writeCacheData;
exports.checkExportedData = checkExportedData;
exports.resolveMode = resolveMode;
exports.resolveConfiguration = resolveConfiguration;
exports.parseConfiguration = parseConfiguration;
exports.mergeConfiguration = mergeConfiguration;
exports.writeOutput = writeOutput;
exports.createOrSet = createOrSet;
exports.haveCommonElements = haveCommonElements;
exports.haveCommonElementsArr = haveCommonElementsArr;
exports.haveEveryElements = haveEveryElements;
exports.haveEveryElementsArr = haveEveryElementsArr;
exports.haveEveryElementsArr = exports.haveEveryElements = exports.haveCommonElementsArr = exports.haveCommonElements = exports.createOrSet = exports.writeOutput = exports.mergeConfiguration = exports.parseConfiguration = exports.resolveConfiguration = exports.resolveMode = exports.checkExportedData = exports.writeCacheData = exports.retrieveRepositoryPath = void 0;
const core = __importStar(__nccwpck_require__(2186));
const fs = __importStar(__nccwpck_require__(7147));
const path = __importStar(__nccwpck_require__(1017));
@@ -3207,6 +3209,7 @@ function retrieveRepositoryPath(providedPath) {
core.debug(`repositoryPath = '${repositoryPath}'`);
return repositoryPath;
}
exports.retrieveRepositoryPath = retrieveRepositoryPath;
function writeCacheData(data, cacheOutput) {
let cacheFile;
if (cacheOutput && !cacheOutput.startsWith('{')) {
@@ -3230,6 +3233,7 @@ function writeCacheData(data, cacheOutput) {
core.warning(`Failed to write cache file. (${error})`);
}
}
exports.writeCacheData = writeCacheData;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function replacer(key, value) {
if (key === 'repositoryUtils')
@@ -3295,6 +3299,7 @@ function checkExportedData(exportCache, cacheInput) {
return null;
}
}
exports.checkExportedData = checkExportedData;
function resolveMode(mode, commitMode) {
if (commitMode === true) {
return 'COMMIT';
@@ -3310,6 +3315,7 @@ function resolveMode(mode, commitMode) {
}
return 'PR';
}
exports.resolveMode = resolveMode;
/**
* Retrieves the configuration given the file path, if not found it will fallback to the `DefaultConfiguration`
*/
@@ -3335,6 +3341,7 @@ function resolveConfiguration(githubWorkspacePath, configurationFile) {
}
return undefined;
}
exports.resolveConfiguration = resolveConfiguration;
/**
* Reads in the configuration from the JSON file
*/
@@ -3365,6 +3372,7 @@ function parseConfiguration(config) {
return undefined;
}
}
exports.parseConfiguration = parseConfiguration;
/**
* Merges the configurations, will fallback to the DefaultConfiguration value
*/
@@ -3396,6 +3404,7 @@ function mergeConfiguration(jc, fc, mode) {
trim_values: (jc === null || jc === void 0 ? void 0 : jc.trim_values) || (fc === null || fc === void 0 ? void 0 : fc.trim_values) || def.trim_values
};
}
exports.mergeConfiguration = mergeConfiguration;
/**
* Writes the changelog to the given the file
*/
@@ -3411,6 +3420,7 @@ function writeOutput(githubWorkspacePath, outputFile, changelog) {
}
}
}
exports.writeOutput = writeOutput;
function createOrSet(map, key, value) {
const entry = map.get(key);
if (!entry) {
@@ -3420,18 +3430,23 @@ function createOrSet(map, key, value) {
entry.push(value);
}
}
exports.createOrSet = createOrSet;
function haveCommonElements(arr1, arr2) {
return arr1.some(item => arr2.has(item));
}
exports.haveCommonElements = haveCommonElements;
function haveCommonElementsArr(arr1, arr2) {
return haveCommonElements(arr1, new Set(arr2));
}
exports.haveCommonElementsArr = haveCommonElementsArr;
function haveEveryElements(arr1, arr2) {
return arr1.every(item => arr2.has(item));
}
exports.haveEveryElements = haveEveryElements;
function haveEveryElementsArr(arr1, arr2) {
return haveEveryElements(arr1, new Set(arr2));
}
exports.haveEveryElementsArr = haveEveryElementsArr;
/***/ }),
@@ -13645,8 +13660,6 @@ function useColors() {
return false;
}
let m;
// Is webkit? http://stackoverflow.com/a/16459606/376773
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
@@ -13654,7 +13667,7 @@ function useColors() {
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
// Is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) ||
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
// Double check webkit in userAgent just in case we are in a worker
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
}
@@ -20802,7 +20815,7 @@ class HttpsProxyAgent extends agent_base_1.Agent {
const servername = this.connectOpts.servername || this.connectOpts.host;
socket = tls.connect({
...this.connectOpts,
servername,
servername: servername && net.isIP(servername) ? undefined : servername,
});
}
else {
@@ -20843,7 +20856,7 @@ class HttpsProxyAgent extends agent_base_1.Agent {
return tls.connect({
...omit(opts, 'host', 'path', 'port'),
socket,
servername,
servername: net.isIP(servername) ? undefined : servername,
});
}
return socket;
@@ -27065,8 +27078,6 @@ const Range = __nccwpck_require__(9828)
/***/ 9828:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
const SPACE_CHARACTERS = /\s+/g
// hoisted class for cyclic dependency
class Range {
constructor (range, options) {
@@ -27087,7 +27098,7 @@ class Range {
// just put it in the set and return
this.raw = range.value
this.set = [[range]]
this.formatted = undefined
this.format()
return this
}
@@ -27098,7 +27109,10 @@ class Range {
// First reduce all whitespace as much as possible so we do not have to rely
// on potentially slow regexes like \s*. This is then stored and used for
// future error messages as well.
this.raw = range.trim().replace(SPACE_CHARACTERS, ' ')
this.raw = range
.trim()
.split(/\s+/)
.join(' ')
// First, split on ||
this.set = this.raw
@@ -27132,29 +27146,14 @@ class Range {
}
}
this.formatted = undefined
}
get range () {
if (this.formatted === undefined) {
this.formatted = ''
for (let i = 0; i < this.set.length; i++) {
if (i > 0) {
this.formatted += '||'
}
const comps = this.set[i]
for (let k = 0; k < comps.length; k++) {
if (k > 0) {
this.formatted += ' '
}
this.formatted += comps[k].toString().trim()
}
}
}
return this.formatted
this.format()
}
format () {
this.range = this.set
.map((comps) => comps.join(' ').trim())
.join('||')
.trim()
return this.range
}
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+3
View File
@@ -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: '',
+2
View File
@@ -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: '',
+3
View File
@@ -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
}
+3
View File
@@ -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 || '',
+1
View File
@@ -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)