Merge pull request #570 from mikepenz/develop

dev -> main
This commit is contained in:
Mike Penz
2021-11-05 09:04:39 +01:00
committed by GitHub
8 changed files with 273 additions and 68 deletions
+17 -6
View File
@@ -124,6 +124,16 @@ jobs:
## Customization 🖍️
### Note
⚠️ When running this action for non tags trigger the `toTag` will be automatically resolved using the latest tag as retrieved by the git API.
⚠️ The first release tag is a special case since there is no previous release the action can reference to. For this case, there are 2 options:
1. When checking out the source via `git` (E.g.: `actions/checkout`), the action will use the first commit.
2. Create a initial tag on the commit you want to begin a changelog from (for example `v0.0.1`).
💡 By default not specifying `fromTag` or `toTag` will resolve `toTag` from either the `ref` or alternatively fallback to the latest tag from the git API. `fromTag` is resolved by sorting tags using [semver](https://semver.org/). Check the [configuration](#configuration-specification) for alternatives.
### Configuration
The action supports flexible configuration options to modify vast areas of its behavior. To do so, provide the configuration file to the workflow using the `configuration` setting.
@@ -139,10 +149,6 @@ The action supports flexible configuration options to modify vast areas of its b
⚠️ Please note: It is required to have a `checkout` step prior to the changelog step, to allow the action to discover the configuration file.
⚠️ When running this action for a non tags trigger the `toTag` will be automatically resolved using the latest tag as retrieved by the git API.
💡 By default not specifying `fromTag` or `toTag` will resolve `toTag` from either the `ref` or alternatively fallback to the latest tag from the git API. `fromTag` is resolved by sorting tags using [semver](https://semver.org/). Check the [configuration](#configuration-specification) for alternatives.
This configuration is a `.json` file in the following format.
```json
@@ -198,7 +204,11 @@ This configuration is a `.json` file in the following format.
"Owner/qa"
],
"tag_resolver": {
"method": "semver"
"method": "semver",
"filter": {
"pattern": "api-(.+)",
"flags": "gu"
}
},
"base_branches": [
"dev"
@@ -318,7 +328,8 @@ Table of descriptions for the `configuration.json` options to configure the resu
| exclude_merge_branches | An array of branches to be ignored from processing as merge commits |
| tag_resolver | Section to provide configuration for the tag resolving logic. Used if no `fromTag` is provided |
| tag_resolver.method | Defines the method to use. Current options are: `semver`, `sort`. Default: `semver` |
| base_branches | The target branches for the merged PR, ingnores PRs with different target branch. Values can be a `regex`. Default: allow all base branches
| tag_resolver.filter | Defines a regex which is used to filter out tags not matching. |
| base_branches | The target branches for the merged PR, ingnores PRs with different target branch. Values can be a `regex`. Default: allow all base branches |
## Contribute 🧬
+34 -1
View File
@@ -1,6 +1,6 @@
import {resolveConfiguration} from '../src/utils'
import {ReleaseNotesBuilder} from '../src/releaseNotesBuilder'
import {TagInfo, sortTags} from '../src/tags'
import { TagInfo, sortTags, filterTags } from '../src/tags';
jest.setTimeout(180000)
@@ -91,3 +91,36 @@ it('Should order tags alphabetical', async () => {
`a,20.0.2,2.0.0,1000.0.0,10.1.0,10.1.0-2,10.0.0,1.0.0,1.0.0-a01,v1,0.1.0-b01,0.0.1,0.0.1-rc01`
)
})
it('Should filter tags correctly using the regex', async () => {
const tags: TagInfo[] = [
{name: 'api-0.0.1', commit: ''},
{name: 'api-0.0.1-rc01', commit: ''},
{name: 'config-0.1.0', commit: ''},
{name: '0.1.0-b01', commit: ''},
{name: '1.0.0', commit: ''},
{name: '1.0.0-a01', commit: ''},
{name: '2.0.0', commit: ''},
{name: 'ap-10.0.0', commit: ''},
{name: '10.1.0', commit: ''},
{name: 'api-10.1.0-2', commit: ''},
{name: '20.0.2', commit: ''}
]
const tagResolver = {
method: 'non-existing-method',
filter: {
"pattern": "api-(.+)",
"flags": "gu"
}
}
const filtered = filterTags(tags, tagResolver)
.map(function (tag) {
return tag.name
})
.join(',')
expect(filtered).toStrictEqual(
`api-0.0.1,api-0.0.1-rc01,api-10.1.0-2`
)
})
Generated Vendored
+19 -2
View File
@@ -173,7 +173,8 @@ exports.DefaultConfiguration = {
transformers: [],
tag_resolver: {
// defines the logic on how to resolve the previous tag, only relevant if `fromTag` is not specified
method: 'semver' // defines which method to use, by default it will use `semver` (dropping all non matching tags). Alternative `sort` is also available.
method: 'semver',
filter: undefined // filter out all tags not matching the regex
},
base_branches: [] // target branches for the merged PR ignoring PRs with different target branch, by default it will get all PRs
};
@@ -884,7 +885,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.sortTags = exports.Tags = void 0;
exports.sortTags = exports.filterTags = exports.Tags = void 0;
const core = __importStar(__nccwpck_require__(2186));
const github = __importStar(__nccwpck_require__(5438));
const semver = __importStar(__nccwpck_require__(1383));
@@ -1031,6 +1032,22 @@ class Tags {
}
}
exports.Tags = Tags;
/*
* Uses the provided filter (if available) to filter out any tags not currently relevant.
* https://github.com/mikepenz/release-changelog-builder-action/issues/566
*/
function filterTags(tags, tagResolver) {
var _a;
const filter = tagResolver.filter;
if (filter !== undefined) {
const regex = new RegExp(filter.pattern.replace('\\\\', '\\'), (_a = filter.flags) !== null && _a !== void 0 ? _a : 'gu');
return tags.filter(tag => tag.name.match(regex) !== null);
}
else {
return tags;
}
}
exports.filterTags = filterTags;
/*
Sorts an array of tags as shown below:
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+168 -49
View File
@@ -16,16 +16,16 @@
"@types/semver": "^7.3.9",
"moment": "^2.29.1",
"semver": "^7.3.5",
"webpack": "^5.59.1"
"webpack": "^5.61.0"
},
"devDependencies": {
"@types/jest": "^27.0.2",
"@types/node": "^16.11.3",
"@typescript-eslint/parser": "^5.1.0",
"@types/node": "^16.11.6",
"@typescript-eslint/parser": "^5.3.0",
"@vercel/ncc": "^0.31.1",
"eslint": "^8.0.1",
"eslint-plugin-github": "github/eslint-plugin-github#0688bafaac755c06af5449afd6203314f11d285c",
"eslint-plugin-jest": "^25.2.2",
"eslint": "^8.1.0",
"eslint-plugin-github": "^4.3.3",
"eslint-plugin-jest": "^25.2.3",
"jest": "^27.3.1",
"jest-circus": "^27.3.1",
"js-yaml": "^4.1.0",
@@ -1416,9 +1416,9 @@
"dev": true
},
"node_modules/@types/node": {
"version": "16.11.3",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.3.tgz",
"integrity": "sha512-aIYL9Eemcecs1y77XzFGiSc+FdfN58k4J23UEe6+hynf4Wd9g4DzQPwIKL080vSMuubFqy2hWwOzCtJdc6vFKw=="
"version": "16.11.6",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.6.tgz",
"integrity": "sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w=="
},
"node_modules/@types/prettier": {
"version": "2.4.1",
@@ -1540,14 +1540,14 @@
}
},
"node_modules/@typescript-eslint/parser": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.1.0.tgz",
"integrity": "sha512-vx1P+mhCtYw3+bRHmbalq/VKP2Y3gnzNgxGxfEWc6OFpuEL7iQdAeq11Ke3Rhy8NjgB+AHsIWEwni3e+Y7djKA==",
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.3.0.tgz",
"integrity": "sha512-rKu/yAReip7ovx8UwOAszJVO5MgBquo8WjIQcp1gx4pYQCwYzag+I5nVNHO4MqyMkAo0gWt2gWUi+36gWAVKcw==",
"dev": true,
"dependencies": {
"@typescript-eslint/scope-manager": "5.1.0",
"@typescript-eslint/types": "5.1.0",
"@typescript-eslint/typescript-estree": "5.1.0",
"@typescript-eslint/scope-manager": "5.3.0",
"@typescript-eslint/types": "5.3.0",
"@typescript-eslint/typescript-estree": "5.3.0",
"debug": "^4.3.2"
},
"engines": {
@@ -1566,6 +1566,80 @@
}
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.3.0.tgz",
"integrity": "sha512-22Uic9oRlTsPppy5Tcwfj+QET5RWEnZ5414Prby465XxQrQFZ6nnm5KnXgnsAJefG4hEgMnaxTB3kNEyjdjj6A==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "5.3.0",
"@typescript-eslint/visitor-keys": "5.3.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.3.0.tgz",
"integrity": "sha512-fce5pG41/w8O6ahQEhXmMV+xuh4+GayzqEogN24EK+vECA3I6pUwKuLi5QbXO721EMitpQne5VKXofPonYlAQg==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.3.0.tgz",
"integrity": "sha512-FJ0nqcaUOpn/6Z4Jwbtf+o0valjBLkqc3MWkMvrhA2TvzFXtcclIM8F4MBEmYa2kgcI8EZeSAzwoSrIC8JYkug==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "5.3.0",
"@typescript-eslint/visitor-keys": "5.3.0",
"debug": "^4.3.2",
"globby": "^11.0.4",
"is-glob": "^4.0.3",
"semver": "^7.3.5",
"tsutils": "^3.21.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.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": "5.3.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.3.0.tgz",
"integrity": "sha512-oVIAfIQuq0x2TFDNLVavUn548WL+7hdhxYn+9j3YdJJXB7mH9dAmZNJsPDa7Jc+B9WGqoiex7GUDbyMxV0a/aw==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "5.3.0",
"eslint-visitor-keys": "^3.0.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.1.0.tgz",
@@ -2768,9 +2842,9 @@
}
},
"node_modules/eslint": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.0.1.tgz",
"integrity": "sha512-LsgcwZgQ72vZ+SMp4K6pAnk2yFDWL7Ti4pJaRvsZ0Hsw2h8ZjUIW38a9AFn2cZXdBMlScMFYYgsSp4ttFI/0bA==",
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.1.0.tgz",
"integrity": "sha512-JZvNneArGSUsluHWJ8g8MMs3CfIEzwaLx9KyH4tZ2i+R2/rPWzL8c0zg3rHdwYVpN/1sB9gqnjHwz9HoeJpGHw==",
"dev": true,
"dependencies": {
"@eslint/eslintrc": "^1.0.3",
@@ -2929,11 +3003,10 @@
}
},
"node_modules/eslint-plugin-github": {
"version": "0.0.0-dev",
"resolved": "git+ssh://git@github.com/github/eslint-plugin-github.git#0688bafaac755c06af5449afd6203314f11d285c",
"integrity": "sha512-TmV4Axza9tvcFnJEdrWejEclMMuP4xCsSOVuqekVDd+0MBW9/7m/LBfQQbCpDpuI+b4qRvOizzACkBix+35HHQ==",
"version": "4.3.3",
"resolved": "https://registry.npmjs.org/eslint-plugin-github/-/eslint-plugin-github-4.3.3.tgz",
"integrity": "sha512-10FT6LhVTnI3vcu3QE9jZb3xt1nOLT9w62K3QvOqrGkTDQUGVQVIcY6YwXHxQnaxDEDE4nvvXmSdaIBqk78R4A==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^5.1.0",
@@ -3019,9 +3092,9 @@
"dev": true
},
"node_modules/eslint-plugin-jest": {
"version": "25.2.2",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-25.2.2.tgz",
"integrity": "sha512-frn5yhOF60U4kcqozO3zKTNZQUk+mfx037XOy2iiYL8FhorEkuCuL3/flzKcY1ECDP2WYT9ydmvlO3fRW9o4mg==",
"version": "25.2.3",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-25.2.3.tgz",
"integrity": "sha512-Yoa0at3euTjERDvPGPWiItY1uuqKYQ5Ov2SmkSLmKRq9OFiVdEehw0rWuK4PA538k7CNqnvmkztjAB9l+HJ7kQ==",
"dev": true,
"dependencies": {
"@typescript-eslint/experimental-utils": "^5.0.0"
@@ -3036,6 +3109,9 @@
"peerDependenciesMeta": {
"@typescript-eslint/eslint-plugin": {
"optional": true
},
"jest": {
"optional": true
}
}
},
@@ -6460,9 +6536,9 @@
}
},
"node_modules/webpack": {
"version": "5.59.1",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.59.1.tgz",
"integrity": "sha512-I01IQV9K96FlpXX3V0L4nvd7gb0r7thfuu1IfT2P4uOHOA77nKARAKDYGe/tScSHKnffNIyQhLC8kRXzY4KEHQ==",
"version": "5.61.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.61.0.tgz",
"integrity": "sha512-fPdTuaYZ/GMGFm4WrPi2KRCqS1vDp773kj9S0iI5Uc//5cszsFEDgHNaX4Rj1vobUiU1dFIV3mA9k1eHeluFpw==",
"dependencies": {
"@types/eslint-scope": "^3.7.0",
"@types/estree": "^0.0.50",
@@ -7851,9 +7927,9 @@
"dev": true
},
"@types/node": {
"version": "16.11.3",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.3.tgz",
"integrity": "sha512-aIYL9Eemcecs1y77XzFGiSc+FdfN58k4J23UEe6+hynf4Wd9g4DzQPwIKL080vSMuubFqy2hWwOzCtJdc6vFKw=="
"version": "16.11.6",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.6.tgz",
"integrity": "sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w=="
},
"@types/prettier": {
"version": "2.4.1",
@@ -7944,15 +8020,58 @@
}
},
"@typescript-eslint/parser": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.1.0.tgz",
"integrity": "sha512-vx1P+mhCtYw3+bRHmbalq/VKP2Y3gnzNgxGxfEWc6OFpuEL7iQdAeq11Ke3Rhy8NjgB+AHsIWEwni3e+Y7djKA==",
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.3.0.tgz",
"integrity": "sha512-rKu/yAReip7ovx8UwOAszJVO5MgBquo8WjIQcp1gx4pYQCwYzag+I5nVNHO4MqyMkAo0gWt2gWUi+36gWAVKcw==",
"dev": true,
"requires": {
"@typescript-eslint/scope-manager": "5.1.0",
"@typescript-eslint/types": "5.1.0",
"@typescript-eslint/typescript-estree": "5.1.0",
"@typescript-eslint/scope-manager": "5.3.0",
"@typescript-eslint/types": "5.3.0",
"@typescript-eslint/typescript-estree": "5.3.0",
"debug": "^4.3.2"
},
"dependencies": {
"@typescript-eslint/scope-manager": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.3.0.tgz",
"integrity": "sha512-22Uic9oRlTsPppy5Tcwfj+QET5RWEnZ5414Prby465XxQrQFZ6nnm5KnXgnsAJefG4hEgMnaxTB3kNEyjdjj6A==",
"dev": true,
"requires": {
"@typescript-eslint/types": "5.3.0",
"@typescript-eslint/visitor-keys": "5.3.0"
}
},
"@typescript-eslint/types": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.3.0.tgz",
"integrity": "sha512-fce5pG41/w8O6ahQEhXmMV+xuh4+GayzqEogN24EK+vECA3I6pUwKuLi5QbXO721EMitpQne5VKXofPonYlAQg==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.3.0.tgz",
"integrity": "sha512-FJ0nqcaUOpn/6Z4Jwbtf+o0valjBLkqc3MWkMvrhA2TvzFXtcclIM8F4MBEmYa2kgcI8EZeSAzwoSrIC8JYkug==",
"dev": true,
"requires": {
"@typescript-eslint/types": "5.3.0",
"@typescript-eslint/visitor-keys": "5.3.0",
"debug": "^4.3.2",
"globby": "^11.0.4",
"is-glob": "^4.0.3",
"semver": "^7.3.5",
"tsutils": "^3.21.0"
}
},
"@typescript-eslint/visitor-keys": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.3.0.tgz",
"integrity": "sha512-oVIAfIQuq0x2TFDNLVavUn548WL+7hdhxYn+9j3YdJJXB7mH9dAmZNJsPDa7Jc+B9WGqoiex7GUDbyMxV0a/aw==",
"dev": true,
"requires": {
"@typescript-eslint/types": "5.3.0",
"eslint-visitor-keys": "^3.0.0"
}
}
}
},
"@typescript-eslint/scope-manager": {
@@ -8887,9 +9006,9 @@
}
},
"eslint": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.0.1.tgz",
"integrity": "sha512-LsgcwZgQ72vZ+SMp4K6pAnk2yFDWL7Ti4pJaRvsZ0Hsw2h8ZjUIW38a9AFn2cZXdBMlScMFYYgsSp4ttFI/0bA==",
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.1.0.tgz",
"integrity": "sha512-JZvNneArGSUsluHWJ8g8MMs3CfIEzwaLx9KyH4tZ2i+R2/rPWzL8c0zg3rHdwYVpN/1sB9gqnjHwz9HoeJpGHw==",
"dev": true,
"requires": {
"@eslint/eslintrc": "^1.0.3",
@@ -9019,10 +9138,10 @@
}
},
"eslint-plugin-github": {
"version": "git+ssh://git@github.com/github/eslint-plugin-github.git#0688bafaac755c06af5449afd6203314f11d285c",
"integrity": "sha512-TmV4Axza9tvcFnJEdrWejEclMMuP4xCsSOVuqekVDd+0MBW9/7m/LBfQQbCpDpuI+b4qRvOizzACkBix+35HHQ==",
"version": "4.3.3",
"resolved": "https://registry.npmjs.org/eslint-plugin-github/-/eslint-plugin-github-4.3.3.tgz",
"integrity": "sha512-10FT6LhVTnI3vcu3QE9jZb3xt1nOLT9w62K3QvOqrGkTDQUGVQVIcY6YwXHxQnaxDEDE4nvvXmSdaIBqk78R4A==",
"dev": true,
"from": "eslint-plugin-github@github/eslint-plugin-github#0688bafaac755c06af5449afd6203314f11d285c",
"requires": {
"@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^5.1.0",
@@ -9093,9 +9212,9 @@
}
},
"eslint-plugin-jest": {
"version": "25.2.2",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-25.2.2.tgz",
"integrity": "sha512-frn5yhOF60U4kcqozO3zKTNZQUk+mfx037XOy2iiYL8FhorEkuCuL3/flzKcY1ECDP2WYT9ydmvlO3fRW9o4mg==",
"version": "25.2.3",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-25.2.3.tgz",
"integrity": "sha512-Yoa0at3euTjERDvPGPWiItY1uuqKYQ5Ov2SmkSLmKRq9OFiVdEehw0rWuK4PA538k7CNqnvmkztjAB9l+HJ7kQ==",
"dev": true,
"requires": {
"@typescript-eslint/experimental-utils": "^5.0.0"
@@ -11626,9 +11745,9 @@
"dev": true
},
"webpack": {
"version": "5.59.1",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.59.1.tgz",
"integrity": "sha512-I01IQV9K96FlpXX3V0L4nvd7gb0r7thfuu1IfT2P4uOHOA77nKARAKDYGe/tScSHKnffNIyQhLC8kRXzY4KEHQ==",
"version": "5.61.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.61.0.tgz",
"integrity": "sha512-fPdTuaYZ/GMGFm4WrPi2KRCqS1vDp773kj9S0iI5Uc//5cszsFEDgHNaX4Rj1vobUiU1dFIV3mA9k1eHeluFpw==",
"requires": {
"@types/eslint-scope": "^3.7.0",
"@types/estree": "^0.0.50",
+6 -6
View File
@@ -39,16 +39,16 @@
"@types/semver": "^7.3.9",
"moment": "^2.29.1",
"semver": "^7.3.5",
"webpack": "^5.59.1"
"webpack": "^5.61.0"
},
"devDependencies": {
"@types/jest": "^27.0.2",
"@typescript-eslint/parser": "^5.1.0",
"@types/node": "^16.11.3",
"@typescript-eslint/parser": "^5.3.0",
"@types/node": "^16.11.6",
"@vercel/ncc": "^0.31.1",
"eslint": "^8.0.1",
"eslint-plugin-github": "github/eslint-plugin-github#0688bafaac755c06af5449afd6203314f11d285c",
"eslint-plugin-jest": "^25.2.2",
"eslint": "^8.1.0",
"eslint-plugin-github": "^4.3.3",
"eslint-plugin-jest": "^25.2.3",
"jest": "^27.3.1",
"jest-circus": "^27.3.1",
"js-yaml": "^4.1.0",
+8 -3
View File
@@ -22,12 +22,15 @@ export interface Category {
exhaustive?: boolean // requires all labels to be present in the PR
}
export interface Transformer {
export interface Regex {
pattern: string // the regex pattern to match
target?: string // the target string to transform the source string using the regex to
flags?: string // the regex flag to use for RegExp
}
export interface Transformer extends Regex {
target?: string // the target string to transform the source string using the regex to
}
export interface Extractor extends Transformer {
on_property?: 'title' | 'author' | 'milestone' | 'body' | undefined // retrieve the property to extract the value from
method?: 'replace' | 'match' | undefined // the method to use to extract the value, `match` will not use the `target` property
@@ -35,6 +38,7 @@ export interface Extractor extends Transformer {
export interface TagResolver {
method: string // semver, sort
filter?: Regex // the regex to filter the tags
}
export const DefaultConfiguration: Configuration = {
@@ -66,7 +70,8 @@ export const DefaultConfiguration: Configuration = {
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
method: 'semver' // defines which method to use, by default it will use `semver` (dropping all non matching tags). Alternative `sort` is also available.
method: 'semver', // defines which method to use, by default it will use `semver` (dropping all non matching tags). Alternative `sort` is also available.
filter: undefined // filter out all tags not matching the regex
},
base_branches: [] // target branches for the merged PR ignoring PRs with different target branch, by default it will get all PRs
}
+20
View File
@@ -191,6 +191,26 @@ export class Tags {
}
}
/*
* Uses the provided filter (if available) to filter out any tags not currently relevant.
* https://github.com/mikepenz/release-changelog-builder-action/issues/566
*/
export function filterTags(
tags: TagInfo[],
tagResolver: TagResolver
): TagInfo[] {
const filter = tagResolver.filter
if (filter !== undefined) {
const regex = new RegExp(
filter.pattern.replace('\\\\', '\\'),
filter.flags ?? 'gu'
)
return tags.filter(tag => tag.name.match(regex) !== null)
} else {
return tags
}
}
/*
Sorts an array of tags as shown below: