Merge pull request #201 from mikepenz/develop

dev -> main
This commit is contained in:
Mike Penz
2021-02-26 12:20:18 +01:00
committed by GitHub
7 changed files with 171 additions and 157 deletions
Generated Vendored
+33 -28
View File
@@ -39,7 +39,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Commits = void 0; exports.filterCommits = exports.Commits = void 0;
const moment_1 = __importDefault(__nccwpck_require__(9623)); const moment_1 = __importDefault(__nccwpck_require__(9623));
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
class Commits { class Commits {
@@ -111,6 +111,29 @@ class Commits {
} }
} }
exports.Commits = Commits; exports.Commits = Commits;
/**
* Filters out all commits which match the exclude pattern
*/
function filterCommits(commits, excludeMergeBranches) {
const filteredCommits = [];
for (const commit of commits) {
if (excludeMergeBranches) {
let matched = false;
for (const excludeMergeBranch of excludeMergeBranches) {
if (commit.summary.includes(excludeMergeBranch)) {
matched = true;
break;
}
}
if (matched) {
continue;
}
}
filteredCommits.push(commit);
}
return filteredCommits;
}
exports.filterCommits = filterCommits;
/***/ }), /***/ }),
@@ -498,28 +521,6 @@ class PullRequests {
return sortPullRequests(mergedPRs, true); return sortPullRequests(mergedPRs, true);
}); });
} }
/**
* Filters out all commits which match the exclude pattern
*/
filterCommits(commits, excludeMergeBranches) {
const filteredCommits = [];
for (const commit of commits) {
if (excludeMergeBranches) {
let matched = false;
for (const excludeMergeBranch of excludeMergeBranches) {
if (commit.summary.includes(excludeMergeBranch)) {
matched = true;
break;
}
}
if (matched) {
continue;
}
}
filteredCommits.push(commit);
}
return filteredCommits;
}
} }
exports.PullRequests = PullRequests; exports.PullRequests = PullRequests;
function sortPullRequests(pullRequests, ascending) { function sortPullRequests(pullRequests, ascending) {
@@ -665,7 +666,7 @@ class ReleaseNotes {
const pullRequestsApi = new pullRequests_1.PullRequests(octokit); const pullRequestsApi = new pullRequests_1.PullRequests(octokit);
const pullRequests = yield pullRequestsApi.getBetweenDates(owner, repo, fromDate, toDate, configuration.max_pull_requests || configuration_1.DefaultConfiguration.max_pull_requests); const pullRequests = yield pullRequestsApi.getBetweenDates(owner, repo, fromDate, toDate, configuration.max_pull_requests || configuration_1.DefaultConfiguration.max_pull_requests);
core.info(`️ Retrieved ${pullRequests.length} merged PRs for ${owner}/${repo}`); core.info(`️ Retrieved ${pullRequests.length} merged PRs for ${owner}/${repo}`);
const prCommits = pullRequestsApi.filterCommits(commits, configuration.exclude_merge_branches || const prCommits = commits_1.filterCommits(commits, configuration.exclude_merge_branches ||
configuration_1.DefaultConfiguration.exclude_merge_branches); configuration_1.DefaultConfiguration.exclude_merge_branches);
core.info(`️ Retrieved ${prCommits.length} release commits for ${owner}/${repo}`); core.info(`️ Retrieved ${prCommits.length} release commits for ${owner}/${repo}`);
// create array of commits for this release // create array of commits for this release
@@ -680,11 +681,15 @@ class ReleaseNotes {
} }
generateCommitPRs(octokit) { generateCommitPRs(octokit) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const { owner, repo, configuration } = this.options;
const commits = yield this.getCommitHistory(octokit); const commits = yield this.getCommitHistory(octokit);
if (commits.length === 0) { if (commits.length === 0) {
return []; return [];
} }
return commits.map(function (commit) { const prCommits = commits_1.filterCommits(commits, configuration.exclude_merge_branches ||
configuration_1.DefaultConfiguration.exclude_merge_branches);
core.info(`️ Retrieved ${prCommits.length} commits for ${owner}/${repo}`);
return prCommits.map(function (commit) {
return { return {
number: 0, number: 0,
title: commit.summary, title: commit.summary,
@@ -1070,7 +1075,7 @@ function buildChangelog(prs, config, options) {
if (extractor.pattern != null) { if (extractor.pattern != null) {
for (const pr of prs) { for (const pr of prs) {
const label = pr.body.replace(extractor.pattern, extractor.target); const label = pr.body.replace(extractor.pattern, extractor.target);
if (label !== "") { if (label !== '') {
pr.labels.push(label); pr.labels.push(label);
} }
} }
@@ -5740,7 +5745,7 @@ const Endpoints = {
} }
}; };
const VERSION = "4.12.0"; const VERSION = "4.12.2";
function endpointsToMethods(octokit, endpointsMap) { function endpointsToMethods(octokit, endpointsMap) {
const newMethods = {}; const newMethods = {};
@@ -6066,7 +6071,7 @@ var pluginRequestLog = __nccwpck_require__(8883);
var pluginPaginateRest = __nccwpck_require__(4193); var pluginPaginateRest = __nccwpck_require__(4193);
var pluginRestEndpointMethods = __nccwpck_require__(3044); var pluginRestEndpointMethods = __nccwpck_require__(3044);
const VERSION = "18.2.0"; const VERSION = "18.2.1";
const Octokit = core.Octokit.plugin(pluginRequestLog.requestLog, pluginRestEndpointMethods.restEndpointMethods, pluginPaginateRest.paginateRest).defaults({ const Octokit = core.Octokit.plugin(pluginRequestLog.requestLog, pluginRestEndpointMethods.restEndpointMethods, pluginPaginateRest.paginateRest).defaults({
userAgent: `octokit-rest.js/${VERSION}` userAgent: `octokit-rest.js/${VERSION}`
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+91 -91
View File
@@ -11,15 +11,15 @@
"@actions/core": "^1.2.6", "@actions/core": "^1.2.6",
"@actions/exec": "^1.0.4", "@actions/exec": "^1.0.4",
"@actions/github": "^4.0.0", "@actions/github": "^4.0.0",
"@octokit/rest": "^18.2.0", "@octokit/rest": "^18.2.1",
"@types/semver": "^7.3.4", "@types/semver": "^7.3.4",
"moment": "^2.29.1", "moment": "^2.29.1",
"semver": "^7.3.4" "semver": "^7.3.4"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^26.0.19", "@types/jest": "^26.0.19",
"@types/node": "^14.14.30", "@types/node": "^14.14.31",
"@typescript-eslint/parser": "^4.15.1", "@typescript-eslint/parser": "^4.15.2",
"@vercel/ncc": "^0.27.0", "@vercel/ncc": "^0.27.0",
"eslint": "^7.20.0", "eslint": "^7.20.0",
"eslint-plugin-github": "^4.1.1", "eslint-plugin-github": "^4.1.1",
@@ -28,8 +28,8 @@
"jest-circus": "^26.6.3", "jest-circus": "^26.6.3",
"js-yaml": "^4.0.0", "js-yaml": "^4.0.0",
"prettier": "2.2.1", "prettier": "2.2.1",
"ts-jest": "^26.5.1", "ts-jest": "^26.5.2",
"typescript": "^4.1.5" "typescript": "^4.2.2"
} }
}, },
"node_modules/@actions/core": { "node_modules/@actions/core": {
@@ -1016,11 +1016,11 @@
} }
}, },
"node_modules/@octokit/plugin-rest-endpoint-methods": { "node_modules/@octokit/plugin-rest-endpoint-methods": {
"version": "4.12.0", "version": "4.12.2",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.12.0.tgz", "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.12.2.tgz",
"integrity": "sha512-RgnQ1aoetdOJjZYC37LV5FNlL7GY/v1CdC5dur1Zp/UiADJlbRFbAz/xLx26ovXw67dK7EUtwCghS+6QyiI9RA==", "integrity": "sha512-5+MmGusB7wPw7OholtcGaMyjfrsFSpFqtJW8VsrbfU/TuaiQepY4wgVkS7P3TAObX257jrTbbGo/sJLcoGf16g==",
"dependencies": { "dependencies": {
"@octokit/types": "^6.10.0", "@octokit/types": "^6.10.1",
"deprecation": "^2.3.1" "deprecation": "^2.3.1"
}, },
"peerDependencies": { "peerDependencies": {
@@ -1053,20 +1053,20 @@
} }
}, },
"node_modules/@octokit/rest": { "node_modules/@octokit/rest": {
"version": "18.2.0", "version": "18.2.1",
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.2.0.tgz", "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.2.1.tgz",
"integrity": "sha512-xsp6bIqL2sb/NmgLXTxw96caegobRw+YHnzdIi70ruquHtPPDW2cBAONhDYMUuAOeXx0JH2auOeplpk4SQJy1w==", "integrity": "sha512-DdQ1vps41JSyB2axyL1mBwJiXAPibgugIQPOmt0mL/yhwheQ6iuq2aKiJWgGWa9ldMfe3v9gIFYlrFgxQ5ThGQ==",
"dependencies": { "dependencies": {
"@octokit/core": "^3.2.3", "@octokit/core": "^3.2.3",
"@octokit/plugin-paginate-rest": "^2.6.2", "@octokit/plugin-paginate-rest": "^2.6.2",
"@octokit/plugin-request-log": "^1.0.2", "@octokit/plugin-request-log": "^1.0.2",
"@octokit/plugin-rest-endpoint-methods": "4.12.0" "@octokit/plugin-rest-endpoint-methods": "4.12.2"
} }
}, },
"node_modules/@octokit/types": { "node_modules/@octokit/types": {
"version": "6.10.0", "version": "6.10.1",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.10.0.tgz", "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.10.1.tgz",
"integrity": "sha512-aMDo10kglofejJ96edCBIgQLVuzMDyjxmhdgEcoUUD64PlHYSrNsAGqN0wZtoiX4/PCQ3JLA50IpkP1bcKD/cA==", "integrity": "sha512-hgNC5jxKG8/RlqxU/6GThkGrvFpz25+cPzjQjyiXTNBvhyltn2Z4GhFY25+kbtXwZ4Co4zM0goW5jak1KLp1ug==",
"dependencies": { "dependencies": {
"@octokit/openapi-types": "^5.1.0" "@octokit/openapi-types": "^5.1.0"
} }
@@ -1186,9 +1186,9 @@
"dev": true "dev": true
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "14.14.30", "version": "14.14.31",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.30.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.31.tgz",
"integrity": "sha512-gUWhy8s45fQp4PqqKecsnOkdW0kt1IaKjgOIR3HPokkzTmQj9ji2wWFID5THu1MKrtO+d4s2lVrlEhXUsPXSvg==", "integrity": "sha512-vFHy/ezP5qI0rFgJ7aQnjDXwAMrG0KqqIH7tQG5PPv3BWBayOPIQNBjVc/P6hhdZfMx51REc6tfDNXHUio893g==",
"dev": true "dev": true
}, },
"node_modules/@types/normalize-package-data": { "node_modules/@types/normalize-package-data": {
@@ -1286,14 +1286,14 @@
} }
}, },
"node_modules/@typescript-eslint/parser": { "node_modules/@typescript-eslint/parser": {
"version": "4.15.1", "version": "4.15.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.15.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.15.2.tgz",
"integrity": "sha512-V8eXYxNJ9QmXi5ETDguB7O9diAXlIyS+e3xzLoP/oVE4WCAjssxLIa0mqCLsCGXulYJUfT+GV70Jv1vHsdKwtA==", "integrity": "sha512-SHeF8xbsC6z2FKXsaTb1tBCf0QZsjJ94H6Bo51Y1aVEZ4XAefaw5ZAilMoDPlGghe+qtq7XdTiDlGfVTOmvA+Q==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/scope-manager": "4.15.1", "@typescript-eslint/scope-manager": "4.15.2",
"@typescript-eslint/types": "4.15.1", "@typescript-eslint/types": "4.15.2",
"@typescript-eslint/typescript-estree": "4.15.1", "@typescript-eslint/typescript-estree": "4.15.2",
"debug": "^4.1.1" "debug": "^4.1.1"
}, },
"engines": { "engines": {
@@ -1313,13 +1313,13 @@
} }
}, },
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": {
"version": "4.15.1", "version": "4.15.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.15.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.15.2.tgz",
"integrity": "sha512-ibQrTFcAm7yG4C1iwpIYK7vDnFg+fKaZVfvyOm3sNsGAerKfwPVFtYft5EbjzByDJ4dj1WD8/34REJfw/9wdVA==", "integrity": "sha512-Zm0tf/MSKuX6aeJmuXexgdVyxT9/oJJhaCkijv0DvJVT3ui4zY6XYd6iwIo/8GEZGy43cd7w1rFMiCLHbRzAPQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/types": "4.15.1", "@typescript-eslint/types": "4.15.2",
"@typescript-eslint/visitor-keys": "4.15.1" "@typescript-eslint/visitor-keys": "4.15.2"
}, },
"engines": { "engines": {
"node": "^8.10.0 || ^10.13.0 || >=11.10.1" "node": "^8.10.0 || ^10.13.0 || >=11.10.1"
@@ -1330,9 +1330,9 @@
} }
}, },
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": {
"version": "4.15.1", "version": "4.15.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.15.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.15.2.tgz",
"integrity": "sha512-iGsaUyWFyLz0mHfXhX4zO6P7O3sExQpBJ2dgXB0G5g/8PRVfBBsmQIc3r83ranEQTALLR3Vko/fnCIVqmH+mPw==", "integrity": "sha512-r7lW7HFkAarfUylJ2tKndyO9njwSyoy6cpfDKWPX6/ctZA+QyaYscAHXVAfJqtnY6aaTwDYrOhp+ginlbc7HfQ==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": "^8.10.0 || ^10.13.0 || >=11.10.1" "node": "^8.10.0 || ^10.13.0 || >=11.10.1"
@@ -1343,13 +1343,13 @@
} }
}, },
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": {
"version": "4.15.1", "version": "4.15.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.15.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.15.2.tgz",
"integrity": "sha512-z8MN3CicTEumrWAEB2e2CcoZa3KP9+SMYLIA2aM49XW3cWIaiVSOAGq30ffR5XHxRirqE90fgLw3e6WmNx5uNw==", "integrity": "sha512-cGR8C2g5SPtHTQvAymEODeqx90pJHadWsgTtx6GbnTWKqsg7yp6Eaya9nFzUd4KrKhxdYTTFBiYeTPQaz/l8bw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/types": "4.15.1", "@typescript-eslint/types": "4.15.2",
"@typescript-eslint/visitor-keys": "4.15.1", "@typescript-eslint/visitor-keys": "4.15.2",
"debug": "^4.1.1", "debug": "^4.1.1",
"globby": "^11.0.1", "globby": "^11.0.1",
"is-glob": "^4.0.1", "is-glob": "^4.0.1",
@@ -1370,12 +1370,12 @@
} }
}, },
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": {
"version": "4.15.1", "version": "4.15.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.15.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.15.2.tgz",
"integrity": "sha512-tYzaTP9plooRJY8eNlpAewTOqtWW/4ff/5wBjNVaJ0S0wC4Gpq/zDVRTJa5bq2v1pCNQ08xxMCndcvR+h7lMww==", "integrity": "sha512-TME1VgSb7wTwgENN5KVj4Nqg25hP8DisXxNBojM4Nn31rYaNDIocNm5cmjOFfh42n7NVERxWrDFoETO/76ePyg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/types": "4.15.1", "@typescript-eslint/types": "4.15.2",
"eslint-visitor-keys": "^2.0.0" "eslint-visitor-keys": "^2.0.0"
}, },
"engines": { "engines": {
@@ -7803,9 +7803,9 @@
} }
}, },
"node_modules/ts-jest": { "node_modules/ts-jest": {
"version": "26.5.1", "version": "26.5.2",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-26.5.1.tgz", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-26.5.2.tgz",
"integrity": "sha512-G7Rmo3OJMvlqE79amJX8VJKDiRcd7/r61wh9fnvvG8cAjhA9edklGw/dCxRSQmfZ/z8NDums5srSVgwZos1qfg==", "integrity": "sha512-bwyJ2zJieSugf7RB+o8fgkMeoMVMM2KPDE0UklRLuACxjwJsOrZNo6chrcScmK33YavPSwhARffy8dZx5LJdUQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@types/jest": "26.x", "@types/jest": "26.x",
@@ -7951,9 +7951,9 @@
} }
}, },
"node_modules/typescript": { "node_modules/typescript": {
"version": "4.1.5", "version": "4.2.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.5.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.2.tgz",
"integrity": "sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA==", "integrity": "sha512-tbb+NVrLfnsJy3M59lsDgrzWIflR4d4TIUjz+heUnHZwdF7YsrMTKoRERiIvI2lvBG95dfpLxB21WZhys1bgaQ==",
"dev": true, "dev": true,
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",
@@ -9199,11 +9199,11 @@
"requires": {} "requires": {}
}, },
"@octokit/plugin-rest-endpoint-methods": { "@octokit/plugin-rest-endpoint-methods": {
"version": "4.12.0", "version": "4.12.2",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.12.0.tgz", "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.12.2.tgz",
"integrity": "sha512-RgnQ1aoetdOJjZYC37LV5FNlL7GY/v1CdC5dur1Zp/UiADJlbRFbAz/xLx26ovXw67dK7EUtwCghS+6QyiI9RA==", "integrity": "sha512-5+MmGusB7wPw7OholtcGaMyjfrsFSpFqtJW8VsrbfU/TuaiQepY4wgVkS7P3TAObX257jrTbbGo/sJLcoGf16g==",
"requires": { "requires": {
"@octokit/types": "^6.10.0", "@octokit/types": "^6.10.1",
"deprecation": "^2.3.1" "deprecation": "^2.3.1"
} }
}, },
@@ -9233,20 +9233,20 @@
} }
}, },
"@octokit/rest": { "@octokit/rest": {
"version": "18.2.0", "version": "18.2.1",
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.2.0.tgz", "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.2.1.tgz",
"integrity": "sha512-xsp6bIqL2sb/NmgLXTxw96caegobRw+YHnzdIi70ruquHtPPDW2cBAONhDYMUuAOeXx0JH2auOeplpk4SQJy1w==", "integrity": "sha512-DdQ1vps41JSyB2axyL1mBwJiXAPibgugIQPOmt0mL/yhwheQ6iuq2aKiJWgGWa9ldMfe3v9gIFYlrFgxQ5ThGQ==",
"requires": { "requires": {
"@octokit/core": "^3.2.3", "@octokit/core": "^3.2.3",
"@octokit/plugin-paginate-rest": "^2.6.2", "@octokit/plugin-paginate-rest": "^2.6.2",
"@octokit/plugin-request-log": "^1.0.2", "@octokit/plugin-request-log": "^1.0.2",
"@octokit/plugin-rest-endpoint-methods": "4.12.0" "@octokit/plugin-rest-endpoint-methods": "4.12.2"
} }
}, },
"@octokit/types": { "@octokit/types": {
"version": "6.10.0", "version": "6.10.1",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.10.0.tgz", "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.10.1.tgz",
"integrity": "sha512-aMDo10kglofejJ96edCBIgQLVuzMDyjxmhdgEcoUUD64PlHYSrNsAGqN0wZtoiX4/PCQ3JLA50IpkP1bcKD/cA==", "integrity": "sha512-hgNC5jxKG8/RlqxU/6GThkGrvFpz25+cPzjQjyiXTNBvhyltn2Z4GhFY25+kbtXwZ4Co4zM0goW5jak1KLp1ug==",
"requires": { "requires": {
"@octokit/openapi-types": "^5.1.0" "@octokit/openapi-types": "^5.1.0"
} }
@@ -9366,9 +9366,9 @@
"dev": true "dev": true
}, },
"@types/node": { "@types/node": {
"version": "14.14.30", "version": "14.14.31",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.30.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.31.tgz",
"integrity": "sha512-gUWhy8s45fQp4PqqKecsnOkdW0kt1IaKjgOIR3HPokkzTmQj9ji2wWFID5THu1MKrtO+d4s2lVrlEhXUsPXSvg==", "integrity": "sha512-vFHy/ezP5qI0rFgJ7aQnjDXwAMrG0KqqIH7tQG5PPv3BWBayOPIQNBjVc/P6hhdZfMx51REc6tfDNXHUio893g==",
"dev": true "dev": true
}, },
"@types/normalize-package-data": { "@types/normalize-package-data": {
@@ -9440,41 +9440,41 @@
} }
}, },
"@typescript-eslint/parser": { "@typescript-eslint/parser": {
"version": "4.15.1", "version": "4.15.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.15.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.15.2.tgz",
"integrity": "sha512-V8eXYxNJ9QmXi5ETDguB7O9diAXlIyS+e3xzLoP/oVE4WCAjssxLIa0mqCLsCGXulYJUfT+GV70Jv1vHsdKwtA==", "integrity": "sha512-SHeF8xbsC6z2FKXsaTb1tBCf0QZsjJ94H6Bo51Y1aVEZ4XAefaw5ZAilMoDPlGghe+qtq7XdTiDlGfVTOmvA+Q==",
"dev": true, "dev": true,
"requires": { "requires": {
"@typescript-eslint/scope-manager": "4.15.1", "@typescript-eslint/scope-manager": "4.15.2",
"@typescript-eslint/types": "4.15.1", "@typescript-eslint/types": "4.15.2",
"@typescript-eslint/typescript-estree": "4.15.1", "@typescript-eslint/typescript-estree": "4.15.2",
"debug": "^4.1.1" "debug": "^4.1.1"
}, },
"dependencies": { "dependencies": {
"@typescript-eslint/scope-manager": { "@typescript-eslint/scope-manager": {
"version": "4.15.1", "version": "4.15.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.15.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.15.2.tgz",
"integrity": "sha512-ibQrTFcAm7yG4C1iwpIYK7vDnFg+fKaZVfvyOm3sNsGAerKfwPVFtYft5EbjzByDJ4dj1WD8/34REJfw/9wdVA==", "integrity": "sha512-Zm0tf/MSKuX6aeJmuXexgdVyxT9/oJJhaCkijv0DvJVT3ui4zY6XYd6iwIo/8GEZGy43cd7w1rFMiCLHbRzAPQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@typescript-eslint/types": "4.15.1", "@typescript-eslint/types": "4.15.2",
"@typescript-eslint/visitor-keys": "4.15.1" "@typescript-eslint/visitor-keys": "4.15.2"
} }
}, },
"@typescript-eslint/types": { "@typescript-eslint/types": {
"version": "4.15.1", "version": "4.15.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.15.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.15.2.tgz",
"integrity": "sha512-iGsaUyWFyLz0mHfXhX4zO6P7O3sExQpBJ2dgXB0G5g/8PRVfBBsmQIc3r83ranEQTALLR3Vko/fnCIVqmH+mPw==", "integrity": "sha512-r7lW7HFkAarfUylJ2tKndyO9njwSyoy6cpfDKWPX6/ctZA+QyaYscAHXVAfJqtnY6aaTwDYrOhp+ginlbc7HfQ==",
"dev": true "dev": true
}, },
"@typescript-eslint/typescript-estree": { "@typescript-eslint/typescript-estree": {
"version": "4.15.1", "version": "4.15.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.15.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.15.2.tgz",
"integrity": "sha512-z8MN3CicTEumrWAEB2e2CcoZa3KP9+SMYLIA2aM49XW3cWIaiVSOAGq30ffR5XHxRirqE90fgLw3e6WmNx5uNw==", "integrity": "sha512-cGR8C2g5SPtHTQvAymEODeqx90pJHadWsgTtx6GbnTWKqsg7yp6Eaya9nFzUd4KrKhxdYTTFBiYeTPQaz/l8bw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@typescript-eslint/types": "4.15.1", "@typescript-eslint/types": "4.15.2",
"@typescript-eslint/visitor-keys": "4.15.1", "@typescript-eslint/visitor-keys": "4.15.2",
"debug": "^4.1.1", "debug": "^4.1.1",
"globby": "^11.0.1", "globby": "^11.0.1",
"is-glob": "^4.0.1", "is-glob": "^4.0.1",
@@ -9483,12 +9483,12 @@
} }
}, },
"@typescript-eslint/visitor-keys": { "@typescript-eslint/visitor-keys": {
"version": "4.15.1", "version": "4.15.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.15.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.15.2.tgz",
"integrity": "sha512-tYzaTP9plooRJY8eNlpAewTOqtWW/4ff/5wBjNVaJ0S0wC4Gpq/zDVRTJa5bq2v1pCNQ08xxMCndcvR+h7lMww==", "integrity": "sha512-TME1VgSb7wTwgENN5KVj4Nqg25hP8DisXxNBojM4Nn31rYaNDIocNm5cmjOFfh42n7NVERxWrDFoETO/76ePyg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@typescript-eslint/types": "4.15.1", "@typescript-eslint/types": "4.15.2",
"eslint-visitor-keys": "^2.0.0" "eslint-visitor-keys": "^2.0.0"
} }
} }
@@ -14446,9 +14446,9 @@
} }
}, },
"ts-jest": { "ts-jest": {
"version": "26.5.1", "version": "26.5.2",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-26.5.1.tgz", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-26.5.2.tgz",
"integrity": "sha512-G7Rmo3OJMvlqE79amJX8VJKDiRcd7/r61wh9fnvvG8cAjhA9edklGw/dCxRSQmfZ/z8NDums5srSVgwZos1qfg==", "integrity": "sha512-bwyJ2zJieSugf7RB+o8fgkMeoMVMM2KPDE0UklRLuACxjwJsOrZNo6chrcScmK33YavPSwhARffy8dZx5LJdUQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/jest": "26.x", "@types/jest": "26.x",
@@ -14559,9 +14559,9 @@
} }
}, },
"typescript": { "typescript": {
"version": "4.1.5", "version": "4.2.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.5.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.2.tgz",
"integrity": "sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA==", "integrity": "sha512-tbb+NVrLfnsJy3M59lsDgrzWIflR4d4TIUjz+heUnHZwdF7YsrMTKoRERiIvI2lvBG95dfpLxB21WZhys1bgaQ==",
"dev": true "dev": true
}, },
"union-value": { "union-value": {
+5 -5
View File
@@ -35,15 +35,15 @@
"@actions/core": "^1.2.6", "@actions/core": "^1.2.6",
"@actions/exec": "^1.0.4", "@actions/exec": "^1.0.4",
"@actions/github": "^4.0.0", "@actions/github": "^4.0.0",
"@octokit/rest": "^18.2.0", "@octokit/rest": "^18.2.1",
"@types/semver": "^7.3.4", "@types/semver": "^7.3.4",
"moment": "^2.29.1", "moment": "^2.29.1",
"semver": "^7.3.4" "semver": "^7.3.4"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^26.0.19", "@types/jest": "^26.0.19",
"@types/node": "^14.14.30", "@types/node": "^14.14.31",
"@typescript-eslint/parser": "^4.15.1", "@typescript-eslint/parser": "^4.15.2",
"@vercel/ncc": "^0.27.0", "@vercel/ncc": "^0.27.0",
"eslint": "^7.20.0", "eslint": "^7.20.0",
"eslint-plugin-github": "^4.1.1", "eslint-plugin-github": "^4.1.1",
@@ -52,7 +52,7 @@
"jest-circus": "^26.6.3", "jest-circus": "^26.6.3",
"js-yaml": "^4.0.0", "js-yaml": "^4.0.0",
"prettier": "2.2.1", "prettier": "2.2.1",
"ts-jest": "^26.5.1", "ts-jest": "^26.5.2",
"typescript": "^4.1.5" "typescript": "^4.2.2"
} }
} }
+28
View File
@@ -93,3 +93,31 @@ export class Commits {
return commitsResult return commitsResult
} }
} }
/**
* Filters out all commits which match the exclude pattern
*/
export function filterCommits(
commits: CommitInfo[],
excludeMergeBranches: string[]
): CommitInfo[] {
const filteredCommits = []
for (const commit of commits) {
if (excludeMergeBranches) {
let matched = false
for (const excludeMergeBranch of excludeMergeBranches) {
if (commit.summary.includes(excludeMergeBranch)) {
matched = true
break
}
}
if (matched) {
continue
}
}
filteredCommits.push(commit)
}
return filteredCommits
}
-29
View File
@@ -1,7 +1,6 @@
import {Octokit, RestEndpointMethodTypes} from '@octokit/rest' import {Octokit, RestEndpointMethodTypes} from '@octokit/rest'
import moment from 'moment' import moment from 'moment'
import {CommitInfo} from './commits'
import * as core from '@actions/core' import * as core from '@actions/core'
export interface PullRequestInfo { export interface PullRequestInfo {
@@ -129,34 +128,6 @@ export class PullRequests {
return sortPullRequests(mergedPRs, true) return sortPullRequests(mergedPRs, true)
} }
/**
* Filters out all commits which match the exclude pattern
*/
filterCommits(
commits: CommitInfo[],
excludeMergeBranches: string[]
): CommitInfo[] {
const filteredCommits = []
for (const commit of commits) {
if (excludeMergeBranches) {
let matched = false
for (const excludeMergeBranch of excludeMergeBranches) {
if (commit.summary.includes(excludeMergeBranch)) {
matched = true
break
}
}
if (matched) {
continue
}
}
filteredCommits.push(commit)
}
return filteredCommits
}
} }
export function sortPullRequests( export function sortPullRequests(
+13 -3
View File
@@ -1,5 +1,5 @@
import {Octokit} from '@octokit/rest' import {Octokit} from '@octokit/rest'
import {Commits, CommitInfo} from './commits' import {Commits, CommitInfo, filterCommits} from './commits'
import {PullRequestInfo, PullRequests} from './pullRequests' import {PullRequestInfo, PullRequests} from './pullRequests'
import {buildChangelog} from './transform' import {buildChangelog} from './transform'
import * as core from '@actions/core' import * as core from '@actions/core'
@@ -113,7 +113,7 @@ export class ReleaseNotes {
`️ Retrieved ${pullRequests.length} merged PRs for ${owner}/${repo}` `️ Retrieved ${pullRequests.length} merged PRs for ${owner}/${repo}`
) )
const prCommits = pullRequestsApi.filterCommits( const prCommits = filterCommits(
commits, commits,
configuration.exclude_merge_branches || configuration.exclude_merge_branches ||
DefaultConfiguration.exclude_merge_branches DefaultConfiguration.exclude_merge_branches
@@ -137,12 +137,22 @@ export class ReleaseNotes {
private async generateCommitPRs( private async generateCommitPRs(
octokit: Octokit octokit: Octokit
): Promise<PullRequestInfo[]> { ): Promise<PullRequestInfo[]> {
const {owner, repo, configuration} = this.options
const commits = await this.getCommitHistory(octokit) const commits = await this.getCommitHistory(octokit)
if (commits.length === 0) { if (commits.length === 0) {
return [] return []
} }
return commits.map(function (commit) { const prCommits = filterCommits(
commits,
configuration.exclude_merge_branches ||
DefaultConfiguration.exclude_merge_branches
)
core.info(`️ Retrieved ${prCommits.length} commits for ${owner}/${repo}`)
return prCommits.map(function (commit) {
return { return {
number: 0, number: 0,
title: commit.summary, title: commit.summary,