Merge pull request #193 from mikepenz/develop

dev -> main
This commit is contained in:
Mike Penz
2021-02-19 15:08:26 +01:00
committed by GitHub
9 changed files with 322 additions and 91 deletions
+24 -12
View File
@@ -38,6 +38,8 @@
- Super simple integration
- ...even on huge repositories with hundreds of tags
- Parallel releases support
- Rich changelogs based on PRs
- Alternative commit based mode
- Blazingly fast execution
- Supports any git project
- Highly flexible configuration
@@ -160,6 +162,12 @@ This configuration is a `.json` file in the following format.
"template": "${{CHANGELOG}}\n\n<details>\n<summary>Uncategorized</summary>\n\n${{UNCATEGORIZED}}\n</details>",
"pr_template": "- ${{TITLE}}\n - PR: #${{NUMBER}}",
"empty_template": "- no changes",
"label_extractor": [
{
"pattern": "(.) (.+)",
"target": "$1"
}
],
"transformers": [
{
"pattern": "[\\-\\*] (\\[(...|TEST|CI|SKIP)\\])( )?(.+?)\n(.+?[\\-\\*] )(.+)",
@@ -207,18 +215,19 @@ For advanced use cases 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** |
|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `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 |
| `toTag` | Defines until which tag the changelog will consider merged pull requests |
| `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 |
| `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 |
| **Input** | **Description** |
|-------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `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 |
| `toTag` | Defines until which tag the changelog will consider merged pull requests |
| `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 |
| `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 |
| `commitMode` | Special configuration for projects which work without PRs. Uses commit messages as changelog. This mode looses access to information only available for PRs. Default: false |
💡 `${{ secrets.GITHUB_TOKEN }}` only grants rights to the current repository, for other repositories please use a PAT (Personal Access Token).
@@ -271,6 +280,9 @@ Table of descriptions for the `configuration.json` options to configure the resu
| template | Specifies the global template to pick for creating the changelog. See [Template placeholders](#template-placeholders) for possible values |
| pr_template | Defines the per pull request template. See [PR Template placeholders](#pr-template-placeholders) for possible values |
| empty_template | Template to pick if no changes are detected. See [Template placeholders](#template-placeholders) for possible values |
| label_extractor | An array of `transform` specifications, offering a flexible API to extract additinal labels from the body of a PR (in case of commit mode, from the commit message). |
| label_extractor.pattern | A `regex` pattern, extracting values of the change message. |
| label_extractor.target | The result pattern. The result text will be used as label. If empty, no label is created |
| transformers | An array of `transform` specifications, offering a flexible API to modify the text per pull request. This is applied on the change text created with `pr_template`. `transformers` are executed per change, in the order specified |
| transformer.pattern | A `regex` pattern, extracting values of the change message. |
| transformer.target | The result pattern, the regex groups will be filled into. Allows for full transformation of a pull request message. Including potentially specified texts |
+26 -1
View File
@@ -149,7 +149,6 @@ it('Uncategorized category', async () => {
})
it('Verify commit based changelog', async () => {
const configuration = resolveConfiguration(
'',
@@ -174,3 +173,29 @@ it('Verify commit based changelog', async () => {
`## 📦 Uncategorized\n\n- - introduce proper approach to retrieve tag before a given tag\n\n- - configure test case\n\n- Merge pull request #10 from mikepenz/feature/specify_test\n\n\n\n\nUncategorized:\n- - introduce proper approach to retrieve tag before a given tag\n\n- - configure test case\n\n- Merge pull request #10 from mikepenz/feature/specify_test\n\n\n\nIgnored:\n\n\n3\n0`
)
})
it('Verify commit based changelog, with emoji categorisation', async () => {
const configuration = resolveConfiguration(
'',
'configs_test/configuration_commits_emoji.json'
)
const releaseNotesBuilder = new ReleaseNotesBuilder(
null,
'.',
'theapache64',
'stackzy',
'bd3242a6b6eadb24744c478e112c4628e89609c2',
'17a9e4dfaedcabe6a6eff2754bebb715e1c58ec4',
false,
false,
true,
configuration
)
const changeLog = await releaseNotesBuilder.build()
console.log(changeLog)
expect(changeLog).toStrictEqual(
`## 🚀 Features\n\n- add dynamic merging\n- add auto-cleaning\n- add built-in adb support\n- add adb fallback (thanks to @mikepenz ;))\n- add install note\n- add @mikepenz to credits\n\n## 🐛 Fixes\n\n- fix dynamic lib replacement\n- fix apostrophe issue with app name\n- fix java.util.logger error\n\n## 💬 Other\n\n- update screenshot with truecaller stack\n\n`
)
})
@@ -0,0 +1,37 @@
{
"categories": [
{
"title": "## 🚀 Features",
"labels": ["🚀", "🌟"]
},
{
"title": "## 🐛 Fixes",
"labels": ["🐛"]
},
{
"title": "## 🧪 Tests",
"labels": ["🧪"]
},
{
"title": "## 💬 Other",
"labels": ["💬", "📖", "🚨"]
},
{
"title": "## 📦 Dependencies",
"labels": ["dependencies"]
}
],
"pr_template": "${{TITLE}}",
"label_extractor": [
{
"pattern": "(.) (.+)",
"target": "$1"
}
],
"transformers": [
{
"pattern": "(.) (.+)",
"target": "- $2"
}
]
}
Generated Vendored
+39 -14
View File
@@ -146,6 +146,7 @@ exports.DefaultConfiguration = {
}
],
ignore_labels: ['ignore'],
label_extractor: [],
transformers: [],
tag_resolver: {
// defines the logic on how to resolve the previous tag, only relevant if `fromTag` is not specified
@@ -1063,6 +1064,18 @@ function buildChangelog(prs, config, options) {
const sortAsc = sort.toUpperCase() === 'ASC';
prs = pullRequests_1.sortPullRequests(prs, sortAsc);
core.info(`️ Sorted all pull requests ascending: ${sort}`);
// extract additional labels from the commit message
const labelExtractors = validateTransfomers(config.label_extractor);
for (const extractor of labelExtractors) {
if (extractor.pattern != null) {
for (const pr of prs) {
const label = pr.body.replace(extractor.pattern, extractor.target);
if (label !== "") {
pr.labels.push(label);
}
}
}
}
const validatedTransformers = validateTransfomers(config.transformers);
const transformedMap = new Map();
// convert PRs to their text representation
@@ -1191,7 +1204,7 @@ function validateTransfomers(specifiedTransformers) {
.map(transformer => {
try {
return {
pattern: new RegExp(transformer.pattern.replace('\\\\', '\\'), 'g'),
pattern: new RegExp(transformer.pattern.replace('\\\\', '\\'), 'gu'),
target: transformer.target
};
}
@@ -4825,12 +4838,16 @@ const Endpoints = {
update: ["PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}"]
},
codeScanning: {
deleteAnalysis: ["DELETE /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id}{?confirm_delete}"],
getAlert: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}", {}, {
renamedParameters: {
alert_id: "alert_number"
}
}],
getAnalysis: ["GET /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id}"],
getSarif: ["GET /repos/{owner}/{repo}/code-scanning/sarifs/{sarif_id}"],
listAlertsForRepo: ["GET /repos/{owner}/{repo}/code-scanning/alerts"],
listAlertsInstances: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances"],
listRecentAnalyses: ["GET /repos/{owner}/{repo}/code-scanning/analyses"],
updateAlert: ["PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}"],
uploadSarif: ["POST /repos/{owner}/{repo}/code-scanning/sarifs"]
@@ -5103,6 +5120,25 @@ const Endpoints = {
updateWebhook: ["PATCH /orgs/{org}/hooks/{hook_id}"],
updateWebhookConfigForOrg: ["PATCH /orgs/{org}/hooks/{hook_id}/config"]
},
packages: {
deletePackageForAuthenticatedUser: ["DELETE /user/packages/{package_type}/{package_name}"],
deletePackageForOrg: ["DELETE /orgs/{org}/packages/{package_type}/{package_name}"],
deletePackageVersionForAuthenticatedUser: ["DELETE /user/packages/{package_type}/{package_name}/versions/{package_version_id}"],
deletePackageVersionForOrg: ["DELETE /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}"],
getAllPackageVersionsForAPackageOwnedByAnOrg: ["GET /orgs/{org}/packages/{package_type}/{package_name}/versions"],
getAllPackageVersionsForAPackageOwnedByTheAuthenticatedUser: ["GET /user/packages/{package_type}/{package_name}/versions"],
getAllPackageVersionsForPackageOwnedByUser: ["GET /users/{username}/packages/{package_type}/{package_name}/versions"],
getPackageForAuthenticatedUser: ["GET /user/packages/{package_type}/{package_name}"],
getPackageForOrganization: ["GET /orgs/{org}/packages/{package_type}/{package_name}"],
getPackageForUser: ["GET /users/{username}/packages/{package_type}/{package_name}"],
getPackageVersionForAuthenticatedUser: ["GET /user/packages/{package_type}/{package_name}/versions/{package_version_id}"],
getPackageVersionForOrganization: ["GET /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}"],
getPackageVersionForUser: ["GET /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}"],
restorePackageForAuthenticatedUser: ["POST /user/packages/{package_type}/{package_name}/restore"],
restorePackageForOrg: ["POST /orgs/{org}/packages/{package_type}/{package_name}/restore"],
restorePackageVersionForAuthenticatedUser: ["POST /user/packages/{package_type}/{package_name}/versions/{package_version_id}/restore"],
restorePackageVersionForOrg: ["POST /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore"]
},
projects: {
addCollaborator: ["PUT /projects/{project_id}/collaborators/{username}", {
mediaType: {
@@ -5704,7 +5740,7 @@ const Endpoints = {
}
};
const VERSION = "4.10.3";
const VERSION = "4.12.0";
function endpointsToMethods(octokit, endpointsMap) {
const newMethods = {};
@@ -5787,17 +5823,6 @@ function decorate(octokit, scope, methodName, defaults, decorations) {
return Object.assign(withDecorations, requestWithDefaults);
}
/**
* This plugin is a 1:1 copy of internal @octokit/rest plugins. The primary
* goal is to rebuild @octokit/rest on top of @octokit/core. Once that is
* done, we will remove the registerEndpoints methods and return the methods
* directly as with the other plugins. At that point we will also remove the
* legacy workarounds and deprecations.
*
* See the plan at
* https://github.com/octokit/plugin-rest-endpoint-methods.js/pull/1
*/
function restEndpointMethods(octokit) {
return endpointsToMethods(octokit, Endpoints);
}
@@ -6041,7 +6066,7 @@ var pluginRequestLog = __nccwpck_require__(8883);
var pluginPaginateRest = __nccwpck_require__(4193);
var pluginRestEndpointMethods = __nccwpck_require__(3044);
const VERSION = "18.1.1";
const VERSION = "18.2.0";
const Octokit = core.Octokit.plugin(pluginRequestLog.requestLog, pluginRestEndpointMethods.restEndpointMethods, pluginPaginateRest.paginateRest).defaults({
userAgent: `octokit-rest.js/${VERSION}`
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+175 -58
View File
@@ -11,19 +11,19 @@
"@actions/core": "^1.2.6",
"@actions/exec": "^1.0.4",
"@actions/github": "^4.0.0",
"@octokit/rest": "^18.1.1",
"@octokit/rest": "^18.2.0",
"@types/semver": "^7.3.4",
"moment": "^2.29.1",
"semver": "^7.3.4"
},
"devDependencies": {
"@types/jest": "^26.0.19",
"@types/node": "^14.14.28",
"@typescript-eslint/parser": "^4.15.0",
"@types/node": "^14.14.30",
"@typescript-eslint/parser": "^4.15.1",
"@vercel/ncc": "^0.27.0",
"eslint": "^7.20.0",
"eslint-plugin-github": "^4.1.1",
"eslint-plugin-jest": "^24.1.3",
"eslint-plugin-jest": "^24.1.5",
"jest": "^26.6.3",
"jest-circus": "^26.6.3",
"js-yaml": "^4.0.0",
@@ -992,9 +992,9 @@
}
},
"node_modules/@octokit/openapi-types": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-4.0.4.tgz",
"integrity": "sha512-31zY8JIuz3h6RAFOnyA8FbOwhILILiBu1qD81RyZZWY7oMBhIdBn6MaAmnnptLhB4jk0g50nkQkUVP4kUzppcA=="
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-5.1.0.tgz",
"integrity": "sha512-bodZvSYgycbUuuKrC/anCBUExvaSSWzMMFz0xl7pcJujxnmGxvqvcFHktjx1ZOSyeNKLfYF0QCgibaHUGsZTng=="
},
"node_modules/@octokit/plugin-paginate-rest": {
"version": "2.9.1",
@@ -1016,11 +1016,11 @@
}
},
"node_modules/@octokit/plugin-rest-endpoint-methods": {
"version": "4.10.3",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.10.3.tgz",
"integrity": "sha512-CsNQeVY34Vs9iea2Z9/TCPlebxv6KpjO9f1BUPz+14qundTSYT9kgf8j5wA1k37VstfBQ4xnuURYdnbGzJBJXw==",
"version": "4.12.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.12.0.tgz",
"integrity": "sha512-RgnQ1aoetdOJjZYC37LV5FNlL7GY/v1CdC5dur1Zp/UiADJlbRFbAz/xLx26ovXw67dK7EUtwCghS+6QyiI9RA==",
"dependencies": {
"@octokit/types": "^6.8.3",
"@octokit/types": "^6.10.0",
"deprecation": "^2.3.1"
},
"peerDependencies": {
@@ -1053,22 +1053,22 @@
}
},
"node_modules/@octokit/rest": {
"version": "18.1.1",
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.1.1.tgz",
"integrity": "sha512-ZcCHMyfGT1qtJD72usigAfUQ6jU89ZUPFb2AOubR6WZ7/RRFVZUENVm1I2yvJBUicqTujezPW9cY1+o3Mb4rNA==",
"version": "18.2.0",
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.2.0.tgz",
"integrity": "sha512-xsp6bIqL2sb/NmgLXTxw96caegobRw+YHnzdIi70ruquHtPPDW2cBAONhDYMUuAOeXx0JH2auOeplpk4SQJy1w==",
"dependencies": {
"@octokit/core": "^3.2.3",
"@octokit/plugin-paginate-rest": "^2.6.2",
"@octokit/plugin-request-log": "^1.0.2",
"@octokit/plugin-rest-endpoint-methods": "4.10.3"
"@octokit/plugin-rest-endpoint-methods": "4.12.0"
}
},
"node_modules/@octokit/types": {
"version": "6.8.5",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.8.5.tgz",
"integrity": "sha512-ZsQawftZoi0kSF2pCsdgLURbOjtVcHnBOXiSxBKSNF56CRjARt5rb/g8WJgqB8vv4lgUEHrv06EdDKYQ22vA9Q==",
"version": "6.10.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.10.0.tgz",
"integrity": "sha512-aMDo10kglofejJ96edCBIgQLVuzMDyjxmhdgEcoUUD64PlHYSrNsAGqN0wZtoiX4/PCQ3JLA50IpkP1bcKD/cA==",
"dependencies": {
"@octokit/openapi-types": "^4.0.3"
"@octokit/openapi-types": "^5.1.0"
}
},
"node_modules/@sinonjs/commons": {
@@ -1186,9 +1186,9 @@
"dev": true
},
"node_modules/@types/node": {
"version": "14.14.28",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.28.tgz",
"integrity": "sha512-lg55ArB+ZiHHbBBttLpzD07akz0QPrZgUODNakeC09i62dnrywr9mFErHuaPlB6I7z+sEbK+IYmplahvplCj2g==",
"version": "14.14.30",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.30.tgz",
"integrity": "sha512-gUWhy8s45fQp4PqqKecsnOkdW0kt1IaKjgOIR3HPokkzTmQj9ji2wWFID5THu1MKrtO+d4s2lVrlEhXUsPXSvg==",
"dev": true
},
"node_modules/@types/normalize-package-data": {
@@ -1286,14 +1286,14 @@
}
},
"node_modules/@typescript-eslint/parser": {
"version": "4.15.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.15.0.tgz",
"integrity": "sha512-L6Dtbq8Bc7g2aZwnIBETpmUa9XDKCMzKVwAArnGp5Mn7PRNFjf3mUzq8UeBjL3K8t311hvevnyqXAMSmxO8Gpg==",
"version": "4.15.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.15.1.tgz",
"integrity": "sha512-V8eXYxNJ9QmXi5ETDguB7O9diAXlIyS+e3xzLoP/oVE4WCAjssxLIa0mqCLsCGXulYJUfT+GV70Jv1vHsdKwtA==",
"dev": true,
"dependencies": {
"@typescript-eslint/scope-manager": "4.15.0",
"@typescript-eslint/types": "4.15.0",
"@typescript-eslint/typescript-estree": "4.15.0",
"@typescript-eslint/scope-manager": "4.15.1",
"@typescript-eslint/types": "4.15.1",
"@typescript-eslint/typescript-estree": "4.15.1",
"debug": "^4.1.1"
},
"engines": {
@@ -1312,6 +1312,80 @@
}
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": {
"version": "4.15.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.15.1.tgz",
"integrity": "sha512-ibQrTFcAm7yG4C1iwpIYK7vDnFg+fKaZVfvyOm3sNsGAerKfwPVFtYft5EbjzByDJ4dj1WD8/34REJfw/9wdVA==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "4.15.1",
"@typescript-eslint/visitor-keys": "4.15.1"
},
"engines": {
"node": "^8.10.0 || ^10.13.0 || >=11.10.1"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": {
"version": "4.15.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.15.1.tgz",
"integrity": "sha512-iGsaUyWFyLz0mHfXhX4zO6P7O3sExQpBJ2dgXB0G5g/8PRVfBBsmQIc3r83ranEQTALLR3Vko/fnCIVqmH+mPw==",
"dev": true,
"engines": {
"node": "^8.10.0 || ^10.13.0 || >=11.10.1"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": {
"version": "4.15.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.15.1.tgz",
"integrity": "sha512-z8MN3CicTEumrWAEB2e2CcoZa3KP9+SMYLIA2aM49XW3cWIaiVSOAGq30ffR5XHxRirqE90fgLw3e6WmNx5uNw==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "4.15.1",
"@typescript-eslint/visitor-keys": "4.15.1",
"debug": "^4.1.1",
"globby": "^11.0.1",
"is-glob": "^4.0.1",
"semver": "^7.3.2",
"tsutils": "^3.17.1"
},
"engines": {
"node": "^10.12.0 || >=12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": {
"version": "4.15.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.15.1.tgz",
"integrity": "sha512-tYzaTP9plooRJY8eNlpAewTOqtWW/4ff/5wBjNVaJ0S0wC4Gpq/zDVRTJa5bq2v1pCNQ08xxMCndcvR+h7lMww==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "4.15.1",
"eslint-visitor-keys": "^2.0.0"
},
"engines": {
"node": "^8.10.0 || ^10.13.0 || >=11.10.1"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "4.15.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.15.0.tgz",
@@ -2841,9 +2915,9 @@
"dev": true
},
"node_modules/eslint-plugin-jest": {
"version": "24.1.3",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-24.1.3.tgz",
"integrity": "sha512-dNGGjzuEzCE3d5EPZQ/QGtmlMotqnYWD/QpCZ1UuZlrMAdhG5rldh0N0haCvhGnUkSeuORS5VNROwF9Hrgn3Lg==",
"version": "24.1.5",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-24.1.5.tgz",
"integrity": "sha512-FIP3lwC8EzEG+rOs1y96cOJmMVpdFNreoDJv29B5vIupVssRi8zrSY3QadogT0K3h1Y8TMxJ6ZSAzYUmFCp2hg==",
"dev": true,
"dependencies": {
"@typescript-eslint/experimental-utils": "^4.0.1"
@@ -9106,9 +9180,9 @@
}
},
"@octokit/openapi-types": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-4.0.4.tgz",
"integrity": "sha512-31zY8JIuz3h6RAFOnyA8FbOwhILILiBu1qD81RyZZWY7oMBhIdBn6MaAmnnptLhB4jk0g50nkQkUVP4kUzppcA=="
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-5.1.0.tgz",
"integrity": "sha512-bodZvSYgycbUuuKrC/anCBUExvaSSWzMMFz0xl7pcJujxnmGxvqvcFHktjx1ZOSyeNKLfYF0QCgibaHUGsZTng=="
},
"@octokit/plugin-paginate-rest": {
"version": "2.9.1",
@@ -9125,11 +9199,11 @@
"requires": {}
},
"@octokit/plugin-rest-endpoint-methods": {
"version": "4.10.3",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.10.3.tgz",
"integrity": "sha512-CsNQeVY34Vs9iea2Z9/TCPlebxv6KpjO9f1BUPz+14qundTSYT9kgf8j5wA1k37VstfBQ4xnuURYdnbGzJBJXw==",
"version": "4.12.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.12.0.tgz",
"integrity": "sha512-RgnQ1aoetdOJjZYC37LV5FNlL7GY/v1CdC5dur1Zp/UiADJlbRFbAz/xLx26ovXw67dK7EUtwCghS+6QyiI9RA==",
"requires": {
"@octokit/types": "^6.8.3",
"@octokit/types": "^6.10.0",
"deprecation": "^2.3.1"
}
},
@@ -9159,22 +9233,22 @@
}
},
"@octokit/rest": {
"version": "18.1.1",
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.1.1.tgz",
"integrity": "sha512-ZcCHMyfGT1qtJD72usigAfUQ6jU89ZUPFb2AOubR6WZ7/RRFVZUENVm1I2yvJBUicqTujezPW9cY1+o3Mb4rNA==",
"version": "18.2.0",
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.2.0.tgz",
"integrity": "sha512-xsp6bIqL2sb/NmgLXTxw96caegobRw+YHnzdIi70ruquHtPPDW2cBAONhDYMUuAOeXx0JH2auOeplpk4SQJy1w==",
"requires": {
"@octokit/core": "^3.2.3",
"@octokit/plugin-paginate-rest": "^2.6.2",
"@octokit/plugin-request-log": "^1.0.2",
"@octokit/plugin-rest-endpoint-methods": "4.10.3"
"@octokit/plugin-rest-endpoint-methods": "4.12.0"
}
},
"@octokit/types": {
"version": "6.8.5",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.8.5.tgz",
"integrity": "sha512-ZsQawftZoi0kSF2pCsdgLURbOjtVcHnBOXiSxBKSNF56CRjARt5rb/g8WJgqB8vv4lgUEHrv06EdDKYQ22vA9Q==",
"version": "6.10.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.10.0.tgz",
"integrity": "sha512-aMDo10kglofejJ96edCBIgQLVuzMDyjxmhdgEcoUUD64PlHYSrNsAGqN0wZtoiX4/PCQ3JLA50IpkP1bcKD/cA==",
"requires": {
"@octokit/openapi-types": "^4.0.3"
"@octokit/openapi-types": "^5.1.0"
}
},
"@sinonjs/commons": {
@@ -9292,9 +9366,9 @@
"dev": true
},
"@types/node": {
"version": "14.14.28",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.28.tgz",
"integrity": "sha512-lg55ArB+ZiHHbBBttLpzD07akz0QPrZgUODNakeC09i62dnrywr9mFErHuaPlB6I7z+sEbK+IYmplahvplCj2g==",
"version": "14.14.30",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.30.tgz",
"integrity": "sha512-gUWhy8s45fQp4PqqKecsnOkdW0kt1IaKjgOIR3HPokkzTmQj9ji2wWFID5THu1MKrtO+d4s2lVrlEhXUsPXSvg==",
"dev": true
},
"@types/normalize-package-data": {
@@ -9366,15 +9440,58 @@
}
},
"@typescript-eslint/parser": {
"version": "4.15.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.15.0.tgz",
"integrity": "sha512-L6Dtbq8Bc7g2aZwnIBETpmUa9XDKCMzKVwAArnGp5Mn7PRNFjf3mUzq8UeBjL3K8t311hvevnyqXAMSmxO8Gpg==",
"version": "4.15.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.15.1.tgz",
"integrity": "sha512-V8eXYxNJ9QmXi5ETDguB7O9diAXlIyS+e3xzLoP/oVE4WCAjssxLIa0mqCLsCGXulYJUfT+GV70Jv1vHsdKwtA==",
"dev": true,
"requires": {
"@typescript-eslint/scope-manager": "4.15.0",
"@typescript-eslint/types": "4.15.0",
"@typescript-eslint/typescript-estree": "4.15.0",
"@typescript-eslint/scope-manager": "4.15.1",
"@typescript-eslint/types": "4.15.1",
"@typescript-eslint/typescript-estree": "4.15.1",
"debug": "^4.1.1"
},
"dependencies": {
"@typescript-eslint/scope-manager": {
"version": "4.15.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.15.1.tgz",
"integrity": "sha512-ibQrTFcAm7yG4C1iwpIYK7vDnFg+fKaZVfvyOm3sNsGAerKfwPVFtYft5EbjzByDJ4dj1WD8/34REJfw/9wdVA==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.15.1",
"@typescript-eslint/visitor-keys": "4.15.1"
}
},
"@typescript-eslint/types": {
"version": "4.15.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.15.1.tgz",
"integrity": "sha512-iGsaUyWFyLz0mHfXhX4zO6P7O3sExQpBJ2dgXB0G5g/8PRVfBBsmQIc3r83ranEQTALLR3Vko/fnCIVqmH+mPw==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
"version": "4.15.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.15.1.tgz",
"integrity": "sha512-z8MN3CicTEumrWAEB2e2CcoZa3KP9+SMYLIA2aM49XW3cWIaiVSOAGq30ffR5XHxRirqE90fgLw3e6WmNx5uNw==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.15.1",
"@typescript-eslint/visitor-keys": "4.15.1",
"debug": "^4.1.1",
"globby": "^11.0.1",
"is-glob": "^4.0.1",
"semver": "^7.3.2",
"tsutils": "^3.17.1"
}
},
"@typescript-eslint/visitor-keys": {
"version": "4.15.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.15.1.tgz",
"integrity": "sha512-tYzaTP9plooRJY8eNlpAewTOqtWW/4ff/5wBjNVaJ0S0wC4Gpq/zDVRTJa5bq2v1pCNQ08xxMCndcvR+h7lMww==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.15.1",
"eslint-visitor-keys": "^2.0.0"
}
}
}
},
"@typescript-eslint/scope-manager": {
@@ -10583,9 +10700,9 @@
}
},
"eslint-plugin-jest": {
"version": "24.1.3",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-24.1.3.tgz",
"integrity": "sha512-dNGGjzuEzCE3d5EPZQ/QGtmlMotqnYWD/QpCZ1UuZlrMAdhG5rldh0N0haCvhGnUkSeuORS5VNROwF9Hrgn3Lg==",
"version": "24.1.5",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-24.1.5.tgz",
"integrity": "sha512-FIP3lwC8EzEG+rOs1y96cOJmMVpdFNreoDJv29B5vIupVssRi8zrSY3QadogT0K3h1Y8TMxJ6ZSAzYUmFCp2hg==",
"dev": true,
"requires": {
"@typescript-eslint/experimental-utils": "^4.0.1"
+4 -4
View File
@@ -35,19 +35,19 @@
"@actions/core": "^1.2.6",
"@actions/exec": "^1.0.4",
"@actions/github": "^4.0.0",
"@octokit/rest": "^18.1.1",
"@octokit/rest": "^18.2.0",
"@types/semver": "^7.3.4",
"moment": "^2.29.1",
"semver": "^7.3.4"
},
"devDependencies": {
"@types/jest": "^26.0.19",
"@types/node": "^14.14.28",
"@typescript-eslint/parser": "^4.15.0",
"@types/node": "^14.14.30",
"@typescript-eslint/parser": "^4.15.1",
"@vercel/ncc": "^0.27.0",
"eslint": "^7.20.0",
"eslint-plugin-github": "^4.1.1",
"eslint-plugin-jest": "^24.1.3",
"eslint-plugin-jest": "^24.1.5",
"jest": "^26.6.3",
"jest-circus": "^26.6.3",
"js-yaml": "^4.0.0",
+2
View File
@@ -9,6 +9,7 @@ export interface Configuration {
empty_template: string
categories: Category[]
ignore_labels: string[]
label_extractor: Transformer[]
transformers: Transformer[]
tag_resolver: TagResolver
}
@@ -51,6 +52,7 @@ export const DefaultConfiguration: Configuration = {
}
], // the categories to support for the ordering
ignore_labels: ['ignore'], // list of lables being ignored from the changelog
label_extractor: [], // extracts additional labels from the commit message given a regex
transformers: [], // transformers to apply on the PR description according to the `pr_template`
tag_resolver: {
// defines the logic on how to resolve the previous tag, only relevant if `fromTag` is not specified
+14 -1
View File
@@ -19,6 +19,19 @@ export function buildChangelog(
prs = sortPullRequests(prs, sortAsc)
core.info(`️ Sorted all pull requests ascending: ${sort}`)
// extract additional labels from the commit message
const labelExtractors = validateTransfomers(config.label_extractor)
for (const extractor of labelExtractors) {
if (extractor.pattern != null) {
for (const pr of prs) {
const label = pr.body.replace(extractor.pattern, extractor.target)
if (label !== '') {
pr.labels.push(label)
}
}
}
}
const validatedTransformers = validateTransfomers(config.transformers)
const transformedMap = new Map<PullRequestInfo, string>()
// convert PRs to their text representation
@@ -210,7 +223,7 @@ function validateTransfomers(
.map(transformer => {
try {
return {
pattern: new RegExp(transformer.pattern.replace('\\\\', '\\'), 'g'),
pattern: new RegExp(transformer.pattern.replace('\\\\', '\\'), 'gu'),
target: transformer.target
}
} catch (e) {