- do not drop PRs if they did not result in an extracted identifier during deduplication

- FIX https://github.com/mikepenz/release-changelog-builder-action/issues/483
- adjust log to `info` if `ID` extraction fails for PR
- merge together PRs post deduplication (with unmatched array)
- ensure proper sorting of PRs post deduplication
This commit is contained in:
Mike Penz
2021-09-14 13:38:49 +02:00
parent a035e38233
commit 99d5df5b47
5 changed files with 77 additions and 64 deletions
Generated Vendored
+12 -2
View File
@@ -1142,19 +1142,22 @@ function buildChangelog(prs, options) {
if (extractor != null) {
core.info(`️ Remove duplicated pull requests using \`duplicate_filter\``);
const deduplicatedMap = new Map();
const unmatched = [];
for (const pr of prs) {
const extracted = extractValues(pr, extractor, 'dupliate_filter');
if (extracted !== null && extracted.length > 0) {
deduplicatedMap.set(extracted[0], pr);
}
else {
core.debug(` PR (${pr.number}) did not resolve a ID using the \`duplicate_filter\``);
core.info(` PR (${pr.number}) did not resolve an ID using the \`duplicate_filter\``);
unmatched.push(pr);
}
}
const deduplicatedPRs = Array.from(deduplicatedMap.values());
deduplicatedPRs.push(...unmatched); // add all unmatched PRs to map
const removedElements = prs.length - deduplicatedPRs.length;
core.info(`️ Removed ${removedElements} pull requests during deduplication`);
prs = deduplicatedPRs;
prs = (0, pullRequests_1.sortPullRequests)(deduplicatedPRs, sortAsc); // resort deduplicatedPRs
}
else {
core.warning(`⚠️ Configured \`duplicate_filter\` invalid.`);
@@ -1445,8 +1448,15 @@ function resolveConfiguration(githubWorkspacePath, configurationFile) {
const providedConfiguration = readConfiguration(configurationPath);
if (providedConfiguration) {
configuration = providedConfiguration;
core.info(`️ Configuration successfully loaded.`);
if (core.isDebug()) {
core.debug(`configuration = ${JSON.stringify(configuration)}`);
}
}
}
else {
core.info(`️ Configuration not provided. Using Defaults.`);
}
return configuration;
}
exports.resolveConfiguration = resolveConfiguration;
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long