@@ -219,6 +219,7 @@ This configuration is a `JSON` in the following format. (The below showcases *ex
|
|||||||
"labels": ["test", "magic"],
|
"labels": ["test", "magic"],
|
||||||
"exclude_labels": ["no-magic"],
|
"exclude_labels": ["no-magic"],
|
||||||
"exhaustive": true,
|
"exhaustive": true,
|
||||||
|
"exhaustive_rules": "false",
|
||||||
"empty_content": "- no matching PRs",
|
"empty_content": "- no matching PRs",
|
||||||
"rules": [
|
"rules": [
|
||||||
{
|
{
|
||||||
@@ -422,6 +423,7 @@ Table of descriptions for the `configuration.json` options to configure the resu
|
|||||||
| category.labels | An array of labels, to match pull request labels against. If any PR label matches any category label, the pull request will show up under this category. (See `exhaustive` to change this) |
|
| category.labels | An array of labels, to match pull request labels against. If any PR label matches any category label, the pull request will show up under this category. (See `exhaustive` to change this) |
|
||||||
| category.exclude_labels | Similar to `labels`, an array of labels to match PRs against, but if a match occurs the PR is excluded from this category. |
|
| category.exclude_labels | Similar to `labels`, an array of labels to match PRs against, but if a match occurs the PR is excluded from this category. |
|
||||||
| category.exhaustive | Will require all labels defined within this category to be present on the matching PR. |
|
| category.exhaustive | Will require all labels defined within this category to be present on the matching PR. |
|
||||||
|
| category.exhaustive_rules | Will require all rules defined within this category to be valid on the matching PR. If not defined, defaults to the value of `exhaustive` |
|
||||||
| category.empty_content | If the category has no matching PRs, this content will be used. When not set, the category will be skipped in the changelog. |
|
| category.empty_content | If the category has no matching PRs, this content will be used. When not set, the category will be skipped in the changelog. |
|
||||||
| category.rules | An array of `rules` used to match PRs against. Any match will include the PR. (See `exhaustive` to change this) |
|
| category.rules | An array of `rules` used to match PRs against. Any match will include the PR. (See `exhaustive` to change this) |
|
||||||
| category.rules.pattern | A `regex` pattern to match the property value towards. Uses `RegExp.test("val")` |
|
| category.rules.pattern | A `regex` pattern to match the property value towards. Uses `RegExp.test("val")` |
|
||||||
|
|||||||
@@ -310,6 +310,46 @@ pullRequestsWithLabels.push(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const openPullRequestsWithLabels: PullRequestInfo[] = []
|
||||||
|
openPullRequestsWithLabels.push(
|
||||||
|
{
|
||||||
|
number: 6,
|
||||||
|
title: 'Still pending open pull request (Current)',
|
||||||
|
htmlURL: '',
|
||||||
|
baseBranch: '',
|
||||||
|
createdAt: moment(),
|
||||||
|
mergedAt: moment(),
|
||||||
|
mergeCommitSha: 'sha1',
|
||||||
|
author: 'Mike',
|
||||||
|
repoName: 'test-repo',
|
||||||
|
labels: new Set<string>().add('feature'),
|
||||||
|
milestone: '',
|
||||||
|
body: 'Some fancy body message',
|
||||||
|
assignees: [],
|
||||||
|
requestedReviewers: [],
|
||||||
|
approvedReviewers: [],
|
||||||
|
status: 'open'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
number: 7,
|
||||||
|
title: 'Still pending open pull request',
|
||||||
|
htmlURL: '',
|
||||||
|
baseBranch: '',
|
||||||
|
createdAt: moment(),
|
||||||
|
mergedAt: moment(),
|
||||||
|
mergeCommitSha: 'sha1',
|
||||||
|
author: 'Mike',
|
||||||
|
repoName: 'test-repo',
|
||||||
|
labels: new Set<string>().add('feature'),
|
||||||
|
milestone: '',
|
||||||
|
body: 'Some fancy body message',
|
||||||
|
assignees: [],
|
||||||
|
requestedReviewers: [],
|
||||||
|
approvedReviewers: [],
|
||||||
|
status: 'open'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
it('Match multiple labels exhaustive for category', async () => {
|
it('Match multiple labels exhaustive for category', async () => {
|
||||||
const customConfig = Object.assign({}, DefaultConfiguration)
|
const customConfig = Object.assign({}, DefaultConfiguration)
|
||||||
customConfig.categories = [
|
customConfig.categories = [
|
||||||
@@ -534,8 +574,46 @@ it('Use Rules to get all open PRs in a Category.', async () => {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
expect(buildChangelogTest(customConfig, prs)).toStrictEqual(`## Open PRs only\n\n- Still pending open pull request\n - PR: #6\n\n`)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
it('Use Rules to get current open PR and merged categorised.', async () => {
|
||||||
|
let prs = Array.from(pullRequestsWithLabels)
|
||||||
|
prs = prs.concat(Array.from(openPullRequestsWithLabels))
|
||||||
|
|
||||||
|
const customConfig = Object.assign({}, DefaultConfiguration)
|
||||||
|
customConfig.categories = [
|
||||||
|
{
|
||||||
|
title: '## 🚀 Features',
|
||||||
|
labels: ['Feature'],
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
pattern: '6',
|
||||||
|
on_property: 'number'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pattern: 'merged',
|
||||||
|
on_property: 'status'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
exhaustive: true,
|
||||||
|
exhaustive_rules: false
|
||||||
|
},{
|
||||||
|
title: '## 🐛 Issues',
|
||||||
|
labels: ['Issue'],
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
pattern: 'merged',
|
||||||
|
on_property: 'status'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
exhaustive: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
expect(buildChangelogTest(customConfig, prs)).toStrictEqual(
|
expect(buildChangelogTest(customConfig, prs)).toStrictEqual(
|
||||||
`## Open PRs only\n\n- Still pending open pull request\n - PR: #6\n\n`
|
`## 🚀 Features\n\n- [ABC-1234] - this is a PR 1 title message\n - PR: #1\n- Still pending open pull request (Current)\n - PR: #6\n- [ABC-1234] - this is a PR 3 title message\n - PR: #3\n\n## 🐛 Issues\n\n- [ABC-4321] - this is a PR 2 title message\n - PR: #2\n- [ABC-1234] - this is a PR 3 title message\n - PR: #3\n\n`
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -571,6 +649,7 @@ it('Use Rules to get all open PRs in one Category and merged categorised.', asyn
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
function buildChangelogTest(config: Configuration, prs: PullRequestInfo[]): string {
|
function buildChangelogTest(config: Configuration, prs: PullRequestInfo[]): string {
|
||||||
return buildChangelog(DefaultDiffInfo, prs, {
|
return buildChangelog(DefaultDiffInfo, prs, {
|
||||||
owner: 'mikepenz',
|
owner: 'mikepenz',
|
||||||
|
|||||||
+170
-102
@@ -728,6 +728,9 @@ function retrieveProperty(pr, property, useCase) {
|
|||||||
else if (Array.isArray(value)) {
|
else if (Array.isArray(value)) {
|
||||||
value = value.join(','); // join into single string
|
value = value.join(','); // join into single string
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
value = value.toString();
|
||||||
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
exports.retrieveProperty = retrieveProperty;
|
exports.retrieveProperty = retrieveProperty;
|
||||||
@@ -1784,8 +1787,12 @@ function buildChangelog(diffInfo, prs, options) {
|
|||||||
if (category.labels !== undefined) {
|
if (category.labels !== undefined) {
|
||||||
matched = (0, utils_1.haveEveryElements)(category.labels.map(lbl => lbl.toLocaleLowerCase('en')), pr.labels);
|
matched = (0, utils_1.haveEveryElements)(category.labels.map(lbl => lbl.toLocaleLowerCase('en')), pr.labels);
|
||||||
}
|
}
|
||||||
|
let exhaustive_rules = true;
|
||||||
|
if (category.exhaustive_rules !== undefined) {
|
||||||
|
exhaustive_rules = category.exhaustive_rules;
|
||||||
|
}
|
||||||
if (matched && category.rules !== undefined) {
|
if (matched && category.rules !== undefined) {
|
||||||
matched = (0, regexUtils_1.matchesRules)(category.rules, pr, true);
|
matched = (0, regexUtils_1.matchesRules)(category.rules, pr, exhaustive_rules);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1794,9 +1801,13 @@ function buildChangelog(diffInfo, prs, options) {
|
|||||||
// check if either any of the labels applies
|
// check if either any of the labels applies
|
||||||
matched = (0, utils_1.haveCommonElements)(category.labels.map(lbl => lbl.toLocaleLowerCase('en')), pr.labels);
|
matched = (0, utils_1.haveCommonElements)(category.labels.map(lbl => lbl.toLocaleLowerCase('en')), pr.labels);
|
||||||
}
|
}
|
||||||
|
let exhaustive_rules = false;
|
||||||
|
if (category.exhaustive_rules !== undefined) {
|
||||||
|
exhaustive_rules = category.exhaustive_rules;
|
||||||
|
}
|
||||||
if (!matched && category.rules !== undefined) {
|
if (!matched && category.rules !== undefined) {
|
||||||
// if no label did apply, check if any rule applies
|
// if no label did apply, check if any rule applies
|
||||||
matched = (0, regexUtils_1.matchesRules)(category.rules, pr, false);
|
matched = (0, regexUtils_1.matchesRules)(category.rules, pr, exhaustive_rules);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (matched) {
|
if (matched) {
|
||||||
@@ -19824,13 +19835,6 @@ class Comparator {
|
|||||||
throw new TypeError('a Comparator is required')
|
throw new TypeError('a Comparator is required')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!options || typeof options !== 'object') {
|
|
||||||
options = {
|
|
||||||
loose: !!options,
|
|
||||||
includePrerelease: false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.operator === '') {
|
if (this.operator === '') {
|
||||||
if (this.value === '') {
|
if (this.value === '') {
|
||||||
return true
|
return true
|
||||||
@@ -19843,32 +19847,43 @@ class Comparator {
|
|||||||
return new Range(this.value, options).test(comp.semver)
|
return new Range(this.value, options).test(comp.semver)
|
||||||
}
|
}
|
||||||
|
|
||||||
const sameDirectionIncreasing =
|
options = parseOptions(options)
|
||||||
(this.operator === '>=' || this.operator === '>') &&
|
|
||||||
(comp.operator === '>=' || comp.operator === '>')
|
|
||||||
const sameDirectionDecreasing =
|
|
||||||
(this.operator === '<=' || this.operator === '<') &&
|
|
||||||
(comp.operator === '<=' || comp.operator === '<')
|
|
||||||
const sameSemVer = this.semver.version === comp.semver.version
|
|
||||||
const differentDirectionsInclusive =
|
|
||||||
(this.operator === '>=' || this.operator === '<=') &&
|
|
||||||
(comp.operator === '>=' || comp.operator === '<=')
|
|
||||||
const oppositeDirectionsLessThan =
|
|
||||||
cmp(this.semver, '<', comp.semver, options) &&
|
|
||||||
(this.operator === '>=' || this.operator === '>') &&
|
|
||||||
(comp.operator === '<=' || comp.operator === '<')
|
|
||||||
const oppositeDirectionsGreaterThan =
|
|
||||||
cmp(this.semver, '>', comp.semver, options) &&
|
|
||||||
(this.operator === '<=' || this.operator === '<') &&
|
|
||||||
(comp.operator === '>=' || comp.operator === '>')
|
|
||||||
|
|
||||||
return (
|
// Special cases where nothing can possibly be lower
|
||||||
sameDirectionIncreasing ||
|
if (options.includePrerelease &&
|
||||||
sameDirectionDecreasing ||
|
(this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
|
||||||
(sameSemVer && differentDirectionsInclusive) ||
|
return false
|
||||||
oppositeDirectionsLessThan ||
|
}
|
||||||
oppositeDirectionsGreaterThan
|
if (!options.includePrerelease &&
|
||||||
)
|
(this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Same direction increasing (> or >=)
|
||||||
|
if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// Same direction decreasing (< or <=)
|
||||||
|
if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// same SemVer and both sides are inclusive (<= or >=)
|
||||||
|
if (
|
||||||
|
(this.semver.version === comp.semver.version) &&
|
||||||
|
this.operator.includes('=') && comp.operator.includes('=')) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// opposite directions less than
|
||||||
|
if (cmp(this.semver, '<', comp.semver, options) &&
|
||||||
|
this.operator.startsWith('>') && comp.operator.startsWith('<')) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// opposite directions greater than
|
||||||
|
if (cmp(this.semver, '>', comp.semver, options) &&
|
||||||
|
this.operator.startsWith('<') && comp.operator.startsWith('>')) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19970,8 +19985,10 @@ class Range {
|
|||||||
|
|
||||||
// memoize range parsing for performance.
|
// memoize range parsing for performance.
|
||||||
// this is a very hot path, and fully deterministic.
|
// this is a very hot path, and fully deterministic.
|
||||||
const memoOpts = Object.keys(this.options).join(',')
|
const memoOpts =
|
||||||
const memoKey = `parseRange:${memoOpts}:${range}`
|
(this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |
|
||||||
|
(this.options.loose && FLAG_LOOSE)
|
||||||
|
const memoKey = memoOpts + ':' + range
|
||||||
const cached = cache.get(memoKey)
|
const cached = cache.get(memoKey)
|
||||||
if (cached) {
|
if (cached) {
|
||||||
return cached
|
return cached
|
||||||
@@ -20079,6 +20096,7 @@ class Range {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Range
|
module.exports = Range
|
||||||
|
|
||||||
const LRU = __nccwpck_require__(7129)
|
const LRU = __nccwpck_require__(7129)
|
||||||
@@ -20095,6 +20113,7 @@ const {
|
|||||||
tildeTrimReplace,
|
tildeTrimReplace,
|
||||||
caretTrimReplace,
|
caretTrimReplace,
|
||||||
} = __nccwpck_require__(9523)
|
} = __nccwpck_require__(9523)
|
||||||
|
const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = __nccwpck_require__(2293)
|
||||||
|
|
||||||
const isNullSet = c => c.value === '<0.0.0-0'
|
const isNullSet = c => c.value === '<0.0.0-0'
|
||||||
const isAny = c => c.value === ''
|
const isAny = c => c.value === ''
|
||||||
@@ -20434,7 +20453,7 @@ class SemVer {
|
|||||||
version = version.version
|
version = version.version
|
||||||
}
|
}
|
||||||
} else if (typeof version !== 'string') {
|
} else if (typeof version !== 'string') {
|
||||||
throw new TypeError(`Invalid Version: ${version}`)
|
throw new TypeError(`Invalid Version: ${(__nccwpck_require__(3837).inspect)(version)}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version.length > MAX_LENGTH) {
|
if (version.length > MAX_LENGTH) {
|
||||||
@@ -20593,36 +20612,36 @@ class SemVer {
|
|||||||
|
|
||||||
// preminor will bump the version up to the next minor release, and immediately
|
// preminor will bump the version up to the next minor release, and immediately
|
||||||
// down to pre-release. premajor and prepatch work the same way.
|
// down to pre-release. premajor and prepatch work the same way.
|
||||||
inc (release, identifier) {
|
inc (release, identifier, identifierBase) {
|
||||||
switch (release) {
|
switch (release) {
|
||||||
case 'premajor':
|
case 'premajor':
|
||||||
this.prerelease.length = 0
|
this.prerelease.length = 0
|
||||||
this.patch = 0
|
this.patch = 0
|
||||||
this.minor = 0
|
this.minor = 0
|
||||||
this.major++
|
this.major++
|
||||||
this.inc('pre', identifier)
|
this.inc('pre', identifier, identifierBase)
|
||||||
break
|
break
|
||||||
case 'preminor':
|
case 'preminor':
|
||||||
this.prerelease.length = 0
|
this.prerelease.length = 0
|
||||||
this.patch = 0
|
this.patch = 0
|
||||||
this.minor++
|
this.minor++
|
||||||
this.inc('pre', identifier)
|
this.inc('pre', identifier, identifierBase)
|
||||||
break
|
break
|
||||||
case 'prepatch':
|
case 'prepatch':
|
||||||
// If this is already a prerelease, it will bump to the next version
|
// If this is already a prerelease, it will bump to the next version
|
||||||
// drop any prereleases that might already exist, since they are not
|
// drop any prereleases that might already exist, since they are not
|
||||||
// relevant at this point.
|
// relevant at this point.
|
||||||
this.prerelease.length = 0
|
this.prerelease.length = 0
|
||||||
this.inc('patch', identifier)
|
this.inc('patch', identifier, identifierBase)
|
||||||
this.inc('pre', identifier)
|
this.inc('pre', identifier, identifierBase)
|
||||||
break
|
break
|
||||||
// If the input is a non-prerelease version, this acts the same as
|
// If the input is a non-prerelease version, this acts the same as
|
||||||
// prepatch.
|
// prepatch.
|
||||||
case 'prerelease':
|
case 'prerelease':
|
||||||
if (this.prerelease.length === 0) {
|
if (this.prerelease.length === 0) {
|
||||||
this.inc('patch', identifier)
|
this.inc('patch', identifier, identifierBase)
|
||||||
}
|
}
|
||||||
this.inc('pre', identifier)
|
this.inc('pre', identifier, identifierBase)
|
||||||
break
|
break
|
||||||
|
|
||||||
case 'major':
|
case 'major':
|
||||||
@@ -20664,9 +20683,15 @@ class SemVer {
|
|||||||
break
|
break
|
||||||
// This probably shouldn't be used publicly.
|
// This probably shouldn't be used publicly.
|
||||||
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
||||||
case 'pre':
|
case 'pre': {
|
||||||
|
const base = Number(identifierBase) ? 1 : 0
|
||||||
|
|
||||||
|
if (!identifier && identifierBase === false) {
|
||||||
|
throw new Error('invalid increment argument: identifier is empty')
|
||||||
|
}
|
||||||
|
|
||||||
if (this.prerelease.length === 0) {
|
if (this.prerelease.length === 0) {
|
||||||
this.prerelease = [0]
|
this.prerelease = [base]
|
||||||
} else {
|
} else {
|
||||||
let i = this.prerelease.length
|
let i = this.prerelease.length
|
||||||
while (--i >= 0) {
|
while (--i >= 0) {
|
||||||
@@ -20677,22 +20702,29 @@ class SemVer {
|
|||||||
}
|
}
|
||||||
if (i === -1) {
|
if (i === -1) {
|
||||||
// didn't increment anything
|
// didn't increment anything
|
||||||
this.prerelease.push(0)
|
if (identifier === this.prerelease.join('.') && identifierBase === false) {
|
||||||
|
throw new Error('invalid increment argument: identifier already exists')
|
||||||
|
}
|
||||||
|
this.prerelease.push(base)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (identifier) {
|
if (identifier) {
|
||||||
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
||||||
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
||||||
|
let prerelease = [identifier, base]
|
||||||
|
if (identifierBase === false) {
|
||||||
|
prerelease = [identifier]
|
||||||
|
}
|
||||||
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
||||||
if (isNaN(this.prerelease[1])) {
|
if (isNaN(this.prerelease[1])) {
|
||||||
this.prerelease = [identifier, 0]
|
this.prerelease = prerelease
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.prerelease = [identifier, 0]
|
this.prerelease = prerelease
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
throw new Error(`invalid increment argument: ${release}`)
|
throw new Error(`invalid increment argument: ${release}`)
|
||||||
}
|
}
|
||||||
@@ -20878,27 +20910,58 @@ module.exports = compare
|
|||||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
const parse = __nccwpck_require__(5925)
|
const parse = __nccwpck_require__(5925)
|
||||||
const eq = __nccwpck_require__(1898)
|
|
||||||
|
|
||||||
const diff = (version1, version2) => {
|
const diff = (version1, version2) => {
|
||||||
if (eq(version1, version2)) {
|
const v1 = parse(version1, null, true)
|
||||||
|
const v2 = parse(version2, null, true)
|
||||||
|
const comparison = v1.compare(v2)
|
||||||
|
|
||||||
|
if (comparison === 0) {
|
||||||
return null
|
return null
|
||||||
} else {
|
|
||||||
const v1 = parse(version1)
|
|
||||||
const v2 = parse(version2)
|
|
||||||
const hasPre = v1.prerelease.length || v2.prerelease.length
|
|
||||||
const prefix = hasPre ? 'pre' : ''
|
|
||||||
const defaultResult = hasPre ? 'prerelease' : ''
|
|
||||||
for (const key in v1) {
|
|
||||||
if (key === 'major' || key === 'minor' || key === 'patch') {
|
|
||||||
if (v1[key] !== v2[key]) {
|
|
||||||
return prefix + key
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const v1Higher = comparison > 0
|
||||||
|
const highVersion = v1Higher ? v1 : v2
|
||||||
|
const lowVersion = v1Higher ? v2 : v1
|
||||||
|
const highHasPre = !!highVersion.prerelease.length
|
||||||
|
|
||||||
|
// add the `pre` prefix if we are going to a prerelease version
|
||||||
|
const prefix = highHasPre ? 'pre' : ''
|
||||||
|
|
||||||
|
if (v1.major !== v2.major) {
|
||||||
|
return prefix + 'major'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (v1.minor !== v2.minor) {
|
||||||
|
return prefix + 'minor'
|
||||||
}
|
}
|
||||||
return defaultResult // may be undefined
|
|
||||||
|
if (v1.patch !== v2.patch) {
|
||||||
|
return prefix + 'patch'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// at this point we know stable versions match but overall versions are not equal,
|
||||||
|
// so either they are both prereleases, or the lower version is a prerelease
|
||||||
|
|
||||||
|
if (highHasPre) {
|
||||||
|
// high and low are preleases
|
||||||
|
return 'prerelease'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lowVersion.patch) {
|
||||||
|
// anything higher than a patch bump would result in the wrong version
|
||||||
|
return 'patch'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lowVersion.minor) {
|
||||||
|
// anything higher than a minor bump would result in the wrong version
|
||||||
|
return 'minor'
|
||||||
|
}
|
||||||
|
|
||||||
|
// bumping major/minor/patch all have same result
|
||||||
|
return 'major'
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = diff
|
module.exports = diff
|
||||||
|
|
||||||
|
|
||||||
@@ -20939,8 +21002,9 @@ module.exports = gte
|
|||||||
|
|
||||||
const SemVer = __nccwpck_require__(8088)
|
const SemVer = __nccwpck_require__(8088)
|
||||||
|
|
||||||
const inc = (version, release, options, identifier) => {
|
const inc = (version, release, options, identifier, identifierBase) => {
|
||||||
if (typeof (options) === 'string') {
|
if (typeof (options) === 'string') {
|
||||||
|
identifierBase = identifier
|
||||||
identifier = options
|
identifier = options
|
||||||
options = undefined
|
options = undefined
|
||||||
}
|
}
|
||||||
@@ -20949,7 +21013,7 @@ const inc = (version, release, options, identifier) => {
|
|||||||
return new SemVer(
|
return new SemVer(
|
||||||
version instanceof SemVer ? version.version : version,
|
version instanceof SemVer ? version.version : version,
|
||||||
options
|
options
|
||||||
).inc(release, identifier).version
|
).inc(release, identifier, identifierBase).version
|
||||||
} catch (er) {
|
} catch (er) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@@ -21012,36 +21076,19 @@ module.exports = neq
|
|||||||
/***/ 5925:
|
/***/ 5925:
|
||||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
const { MAX_LENGTH } = __nccwpck_require__(2293)
|
|
||||||
const { re, t } = __nccwpck_require__(9523)
|
|
||||||
const SemVer = __nccwpck_require__(8088)
|
const SemVer = __nccwpck_require__(8088)
|
||||||
|
const parse = (version, options, throwErrors = false) => {
|
||||||
const parseOptions = __nccwpck_require__(785)
|
|
||||||
const parse = (version, options) => {
|
|
||||||
options = parseOptions(options)
|
|
||||||
|
|
||||||
if (version instanceof SemVer) {
|
if (version instanceof SemVer) {
|
||||||
return version
|
return version
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof version !== 'string') {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
if (version.length > MAX_LENGTH) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
const r = options.loose ? re[t.LOOSE] : re[t.FULL]
|
|
||||||
if (!r.test(version)) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return new SemVer(version, options)
|
return new SemVer(version, options)
|
||||||
} catch (er) {
|
} catch (er) {
|
||||||
|
if (!throwErrors) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
throw er
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = parse
|
module.exports = parse
|
||||||
@@ -21220,6 +21267,7 @@ module.exports = {
|
|||||||
src: internalRe.src,
|
src: internalRe.src,
|
||||||
tokens: internalRe.t,
|
tokens: internalRe.t,
|
||||||
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
||||||
|
RELEASE_TYPES: constants.RELEASE_TYPES,
|
||||||
compareIdentifiers: identifiers.compareIdentifiers,
|
compareIdentifiers: identifiers.compareIdentifiers,
|
||||||
rcompareIdentifiers: identifiers.rcompareIdentifiers,
|
rcompareIdentifiers: identifiers.rcompareIdentifiers,
|
||||||
}
|
}
|
||||||
@@ -21241,11 +21289,24 @@ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
|
|||||||
// Max safe segment length for coercion.
|
// Max safe segment length for coercion.
|
||||||
const MAX_SAFE_COMPONENT_LENGTH = 16
|
const MAX_SAFE_COMPONENT_LENGTH = 16
|
||||||
|
|
||||||
|
const RELEASE_TYPES = [
|
||||||
|
'major',
|
||||||
|
'premajor',
|
||||||
|
'minor',
|
||||||
|
'preminor',
|
||||||
|
'patch',
|
||||||
|
'prepatch',
|
||||||
|
'prerelease',
|
||||||
|
]
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
SEMVER_SPEC_VERSION,
|
|
||||||
MAX_LENGTH,
|
MAX_LENGTH,
|
||||||
MAX_SAFE_INTEGER,
|
|
||||||
MAX_SAFE_COMPONENT_LENGTH,
|
MAX_SAFE_COMPONENT_LENGTH,
|
||||||
|
MAX_SAFE_INTEGER,
|
||||||
|
RELEASE_TYPES,
|
||||||
|
SEMVER_SPEC_VERSION,
|
||||||
|
FLAG_INCLUDE_PRERELEASE: 0b001,
|
||||||
|
FLAG_LOOSE: 0b010,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -21300,16 +21361,20 @@ module.exports = {
|
|||||||
/***/ 785:
|
/***/ 785:
|
||||||
/***/ ((module) => {
|
/***/ ((module) => {
|
||||||
|
|
||||||
// parse out just the options we care about so we always get a consistent
|
// parse out just the options we care about
|
||||||
// obj with keys in a consistent order.
|
const looseOption = Object.freeze({ loose: true })
|
||||||
const opts = ['includePrerelease', 'loose', 'rtl']
|
const emptyOpts = Object.freeze({ })
|
||||||
const parseOptions = options =>
|
const parseOptions = options => {
|
||||||
!options ? {}
|
if (!options) {
|
||||||
: typeof options !== 'object' ? { loose: true }
|
return emptyOpts
|
||||||
: opts.filter(k => options[k]).reduce((o, k) => {
|
}
|
||||||
o[k] = true
|
|
||||||
return o
|
if (typeof options !== 'object') {
|
||||||
}, {})
|
return looseOption
|
||||||
|
}
|
||||||
|
|
||||||
|
return options
|
||||||
|
}
|
||||||
module.exports = parseOptions
|
module.exports = parseOptions
|
||||||
|
|
||||||
|
|
||||||
@@ -21522,7 +21587,7 @@ const Range = __nccwpck_require__(9828)
|
|||||||
const intersects = (r1, r2, options) => {
|
const intersects = (r1, r2, options) => {
|
||||||
r1 = new Range(r1, options)
|
r1 = new Range(r1, options)
|
||||||
r2 = new Range(r2, options)
|
r2 = new Range(r2, options)
|
||||||
return r1.intersects(r2)
|
return r1.intersects(r2, options)
|
||||||
}
|
}
|
||||||
module.exports = intersects
|
module.exports = intersects
|
||||||
|
|
||||||
@@ -21885,6 +21950,9 @@ const subset = (sub, dom, options = {}) => {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')]
|
||||||
|
const minimumVersion = [new Comparator('>=0.0.0')]
|
||||||
|
|
||||||
const simpleSubset = (sub, dom, options) => {
|
const simpleSubset = (sub, dom, options) => {
|
||||||
if (sub === dom) {
|
if (sub === dom) {
|
||||||
return true
|
return true
|
||||||
@@ -21894,9 +21962,9 @@ const simpleSubset = (sub, dom, options) => {
|
|||||||
if (dom.length === 1 && dom[0].semver === ANY) {
|
if (dom.length === 1 && dom[0].semver === ANY) {
|
||||||
return true
|
return true
|
||||||
} else if (options.includePrerelease) {
|
} else if (options.includePrerelease) {
|
||||||
sub = [new Comparator('>=0.0.0-0')]
|
sub = minimumVersionWithPreRelease
|
||||||
} else {
|
} else {
|
||||||
sub = [new Comparator('>=0.0.0')]
|
sub = minimumVersion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21904,7 +21972,7 @@ const simpleSubset = (sub, dom, options) => {
|
|||||||
if (options.includePrerelease) {
|
if (options.includePrerelease) {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
dom = [new Comparator('>=0.0.0')]
|
dom = minimumVersion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
Generated
+368
-351
File diff suppressed because it is too large
Load Diff
+7
-7
@@ -38,23 +38,23 @@
|
|||||||
"@octokit/rest": "^19.0.7",
|
"@octokit/rest": "^19.0.7",
|
||||||
"https-proxy-agent": "^5.0.1",
|
"https-proxy-agent": "^5.0.1",
|
||||||
"moment": "^2.29.4",
|
"moment": "^2.29.4",
|
||||||
"semver": "^7.3.8",
|
"semver": "^7.5.0",
|
||||||
"tunnel": "^0.0.6",
|
"tunnel": "^0.0.6",
|
||||||
"webpack": "^5.78.0"
|
"webpack": "^5.81.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^29.5.0",
|
"@types/jest": "^29.5.1",
|
||||||
"@types/node": "^18.15.11",
|
"@types/node": "^18.16.3",
|
||||||
"@types/semver": "^7.3.13",
|
"@types/semver": "^7.3.13",
|
||||||
"@typescript-eslint/parser": "^5.57.1",
|
"@typescript-eslint/parser": "^5.59.2",
|
||||||
"@vercel/ncc": "^0.36.1",
|
"@vercel/ncc": "^0.36.1",
|
||||||
"eslint": "^8.38.0",
|
"eslint": "^8.39.0",
|
||||||
"eslint-plugin-github": "^4.7.0",
|
"eslint-plugin-github": "^4.7.0",
|
||||||
"eslint-plugin-jest": "^27.2.1",
|
"eslint-plugin-jest": "^27.2.1",
|
||||||
"jest": "^29.5.0",
|
"jest": "^29.5.0",
|
||||||
"jest-circus": "^29.5.0",
|
"jest-circus": "^29.5.0",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"prettier": "2.8.7",
|
"prettier": "2.8.8",
|
||||||
"ts-jest": "^29.1.0",
|
"ts-jest": "^29.1.0",
|
||||||
"typescript": "^5.0.4"
|
"typescript": "^5.0.4"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ export interface Category {
|
|||||||
labels?: string[] // labels to associate PRs to this category
|
labels?: string[] // labels to associate PRs to this category
|
||||||
exclude_labels?: string[] // if an exclude label is detected, the PR will be excluded from this category
|
exclude_labels?: string[] // if an exclude label is detected, the PR will be excluded from this category
|
||||||
rules?: Rule[] // rules to associate PRs to this category
|
rules?: Rule[] // rules to associate PRs to this category
|
||||||
exhaustive?: boolean // requires all labels AND/OR rules to be present in the PR
|
exhaustive?: boolean // requires all labels to be present in the PR
|
||||||
|
exhaustive_rules?: boolean // requires all rules to be present in the PR (if not set, defaults to exhaustive value)
|
||||||
empty_content?: string // if the category has no matching PRs, this content will be used. If not set, the category will be skipped in the changelog.
|
empty_content?: string // if the category has no matching PRs, this content will be used. If not set, the category will be skipped in the changelog.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,6 +32,7 @@ export interface Category {
|
|||||||
* Defines the properties of the PullRequestInfo useable in different configurations
|
* Defines the properties of the PullRequestInfo useable in different configurations
|
||||||
*/
|
*/
|
||||||
export type Property =
|
export type Property =
|
||||||
|
| 'number'
|
||||||
| 'title'
|
| 'title'
|
||||||
| 'branch'
|
| 'branch'
|
||||||
| 'author'
|
| 'author'
|
||||||
|
|||||||
+3
-1
@@ -212,7 +212,7 @@ export function compare(a: PullRequestInfo, b: PullRequestInfo, sort: Sort): num
|
|||||||
* Helper function to retrieve a property from the PullRequestInfo
|
* Helper function to retrieve a property from the PullRequestInfo
|
||||||
*/
|
*/
|
||||||
export function retrieveProperty(pr: PullRequestInfo, property: Property, useCase: string): string {
|
export function retrieveProperty(pr: PullRequestInfo, property: Property, useCase: string): string {
|
||||||
let value: string | Set<string> | string[] | undefined = pr[property]
|
let value: string | number | Set<string> | string[] | undefined = pr[property]
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
core.warning(`⚠️ the provided property '${property}' for \`${useCase}\` is not valid. Fallback to 'body'`)
|
core.warning(`⚠️ the provided property '${property}' for \`${useCase}\` is not valid. Fallback to 'body'`)
|
||||||
value = pr['body']
|
value = pr['body']
|
||||||
@@ -220,6 +220,8 @@ export function retrieveProperty(pr: PullRequestInfo, property: Property, useCas
|
|||||||
value = Array.from(value).join(',') // join into single string
|
value = Array.from(value).join(',') // join into single string
|
||||||
} else if (Array.isArray(value)) {
|
} else if (Array.isArray(value)) {
|
||||||
value = value.join(',') // join into single string
|
value = value.join(',') // join into single string
|
||||||
|
} else {
|
||||||
|
value = value.toString()
|
||||||
}
|
}
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -133,8 +133,12 @@ export function buildChangelog(diffInfo: DiffInfo, prs: PullRequestInfo[], optio
|
|||||||
pr.labels
|
pr.labels
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
let exhaustive_rules = true
|
||||||
|
if (category.exhaustive_rules !== undefined) {
|
||||||
|
exhaustive_rules = category.exhaustive_rules
|
||||||
|
}
|
||||||
if (matched && category.rules !== undefined) {
|
if (matched && category.rules !== undefined) {
|
||||||
matched = matchesRules(category.rules, pr, true)
|
matched = matchesRules(category.rules, pr, exhaustive_rules)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if not exhaustive, do individual matches
|
// if not exhaustive, do individual matches
|
||||||
@@ -145,9 +149,13 @@ export function buildChangelog(diffInfo: DiffInfo, prs: PullRequestInfo[], optio
|
|||||||
pr.labels
|
pr.labels
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
let exhaustive_rules = false
|
||||||
|
if (category.exhaustive_rules !== undefined) {
|
||||||
|
exhaustive_rules = category.exhaustive_rules
|
||||||
|
}
|
||||||
if (!matched && category.rules !== undefined) {
|
if (!matched && category.rules !== undefined) {
|
||||||
// if no label did apply, check if any rule applies
|
// if no label did apply, check if any rule applies
|
||||||
matched = matchesRules(category.rules, pr, false)
|
matched = matchesRules(category.rules, pr, exhaustive_rules)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (matched) {
|
if (matched) {
|
||||||
|
|||||||
Reference in New Issue
Block a user