diff --git a/dist/commit1.hbs b/dist/commit1.hbs index 28d92937..641c2f37 100644 --- a/dist/commit1.hbs +++ b/dist/commit1.hbs @@ -1,23 +1,16 @@ -* {{header}} - -{{~!-- commit link --}} {{#if @root.linkReferences~}} - ([{{hash}}]( - {{~#if @root.repository}} - {{~#if @root.host}} - {{~@root.host}}/ - {{~/if}} - {{~#if @root.owner}} - {{~@root.owner}}/ - {{~/if}} - {{~@root.repository}} - {{~else}} - {{~@root.repoUrl}} - {{~/if}}/ - {{~@root.commit}}/{{hash}})) +*{{#if scope}} **{{scope}}:** +{{~/if}} {{#if subject}} + {{~subject}} {{~else}} - {{~hash}} + {{~header}} {{~/if}} +{{~!-- commit link --}}{{~#if hash}} {{#if @root.linkReferences~}} + ([{{shortHash}}]({{commitUrlFormat}})) +{{~else}} + {{~shortHash}} +{{~/if}}{{~/if}} + {{~!-- commit references --}} {{~#if references~}} , closes @@ -26,31 +19,12 @@ {{~#if this.owner}} {{~this.owner}}/ {{~/if}} - {{~this.repository}}#{{this.issue}}]( - {{~#if @root.repository}} - {{~#if @root.host}} - {{~@root.host}}/ - {{~/if}} - {{~#if this.repository}} - {{~#if this.owner}} - {{~this.owner}}/ - {{~/if}} - {{~this.repository}} - {{~else}} - {{~#if @root.owner}} - {{~@root.owner}}/ - {{~/if}} - {{~@root.repository}} - {{~/if}} - {{~else}} - {{~@root.repoUrl}} - {{~/if}}/ - {{~@root.issue}}/{{this.issue}}) + {{~this.repository}}{{this.prefix}}{{this.issue}}]({{issueUrlFormat}}) {{~else}} {{~#if this.owner}} {{~this.owner}}/ {{~/if}} - {{~this.repository}}#{{this.issue}} + {{~this.repository}}{{this.prefix}}{{this.issue}} {{~/if}}{{/each}} {{~/if}} diff --git a/dist/commit2.hbs b/dist/commit2.hbs index 641c2f37..28d92937 100644 --- a/dist/commit2.hbs +++ b/dist/commit2.hbs @@ -1,15 +1,22 @@ -*{{#if scope}} **{{scope}}:** -{{~/if}} {{#if subject}} - {{~subject}} -{{~else}} - {{~header}} -{{~/if}} +* {{header}} -{{~!-- commit link --}}{{~#if hash}} {{#if @root.linkReferences~}} - ([{{shortHash}}]({{commitUrlFormat}})) +{{~!-- commit link --}} {{#if @root.linkReferences~}} + ([{{hash}}]( + {{~#if @root.repository}} + {{~#if @root.host}} + {{~@root.host}}/ + {{~/if}} + {{~#if @root.owner}} + {{~@root.owner}}/ + {{~/if}} + {{~@root.repository}} + {{~else}} + {{~@root.repoUrl}} + {{~/if}}/ + {{~@root.commit}}/{{hash}})) {{~else}} - {{~shortHash}} -{{~/if}}{{~/if}} + {{~hash}} +{{~/if}} {{~!-- commit references --}} {{~#if references~}} @@ -19,12 +26,31 @@ {{~#if this.owner}} {{~this.owner}}/ {{~/if}} - {{~this.repository}}{{this.prefix}}{{this.issue}}]({{issueUrlFormat}}) + {{~this.repository}}#{{this.issue}}]( + {{~#if @root.repository}} + {{~#if @root.host}} + {{~@root.host}}/ + {{~/if}} + {{~#if this.repository}} + {{~#if this.owner}} + {{~this.owner}}/ + {{~/if}} + {{~this.repository}} + {{~else}} + {{~#if @root.owner}} + {{~@root.owner}}/ + {{~/if}} + {{~@root.repository}} + {{~/if}} + {{~else}} + {{~@root.repoUrl}} + {{~/if}}/ + {{~@root.issue}}/{{this.issue}}) {{~else}} {{~#if this.owner}} {{~this.owner}}/ {{~/if}} - {{~this.repository}}{{this.prefix}}{{this.issue}} + {{~this.repository}}#{{this.issue}} {{~/if}}{{/each}} {{~/if}} diff --git a/dist/footer.hbs b/dist/footer.hbs index dca482f2..e69de29b 100644 --- a/dist/footer.hbs +++ b/dist/footer.hbs @@ -1,10 +0,0 @@ -{{#if noteGroups}} -{{#each noteGroups}} - -### {{title}} - -{{#each notes}} -* {{text}} -{{/each}} -{{/each}} -{{/if}} diff --git a/dist/footer1.hbs b/dist/footer1.hbs index e69de29b..dca482f2 100644 --- a/dist/footer1.hbs +++ b/dist/footer1.hbs @@ -0,0 +1,10 @@ +{{#if noteGroups}} +{{#each noteGroups}} + +### {{title}} + +{{#each notes}} +* {{text}} +{{/each}} +{{/each}} +{{/if}} diff --git a/dist/header1.hbs b/dist/header1.hbs index 49f56073..a4d6ec43 100644 --- a/dist/header1.hbs +++ b/dist/header1.hbs @@ -1,9 +1,13 @@ -## {{#if isPatch~}} - {{~/if~}} {{version}} - {{~#if title}} "{{title}}" - {{~/if~}} - {{~#if date}} ({{date}}) - {{~/if~}} - {{~#if isPatch~}} - {{~/if}} - +{{#if isPatch~}} + ### +{{~else~}} + ## +{{~/if}} {{#if @root.linkCompare~}} + [{{version}}]({{compareUrlFormat}}) +{{~else}} + {{~version}} +{{~/if}} +{{~#if title}} "{{title}}" +{{~/if}} +{{~#if date}} ({{date}}) +{{/if}} diff --git a/dist/header2.hbs b/dist/header2.hbs index a4d6ec43..49f56073 100644 --- a/dist/header2.hbs +++ b/dist/header2.hbs @@ -1,13 +1,9 @@ -{{#if isPatch~}} - ### -{{~else~}} - ## -{{~/if}} {{#if @root.linkCompare~}} - [{{version}}]({{compareUrlFormat}}) -{{~else}} - {{~version}} -{{~/if}} -{{~#if title}} "{{title}}" -{{~/if}} -{{~#if date}} ({{date}}) -{{/if}} +## {{#if isPatch~}} + {{~/if~}} {{version}} + {{~#if title}} "{{title}}" + {{~/if~}} + {{~#if date}} ({{date}}) + {{~/if~}} + {{~#if isPatch~}} + {{~/if}} + diff --git a/dist/index.js b/dist/index.js index 456f0a91..ff2b8505 100644 --- a/dist/index.js +++ b/dist/index.js @@ -30,11 +30,12 @@ async function main () { const token = core.getInput('token', { required: true }) const fork = getBooleanInput('fork') const changelogPath = core.getInput('changelog-path') || undefined - const changelogTypes = core.getInput('changelog-types') + const changelogTypes = core.getInput('changelog-types') || undefined const changelogSections = changelogTypes && JSON.parse(changelogTypes) const command = core.getInput('command') || undefined const versionFile = core.getInput('version-file') || undefined const defaultBranch = core.getInput('default-branch') || undefined + const pullRequestTitlePattern = core.getInput('pull-request-title-pattern') || undefined // First we check for any merged release PRs (PRs merged with the label // "autorelease: pending"): @@ -48,7 +49,8 @@ async function main () { token, changelogPath, releaseType, - defaultBranch + defaultBranch, + pullRequestTitlePattern }) if (releaseCreated) { @@ -75,7 +77,8 @@ async function main () { bumpMinorPreMajor, changelogSections, versionFile, - defaultBranch + defaultBranch, + pullRequestTitlePattern }) if (pr) { @@ -89,6 +92,7 @@ const releasePlease = { getBooleanInput } +/* c8 ignore next 4 */ if (require.main === require.cache[eval('__filename')]) { main().catch(err => { core.setFailed(`release-please failed: ${err.message}`) @@ -5411,7 +5415,7 @@ const Endpoints = { } }; -const VERSION = "4.12.0"; +const VERSION = "4.12.2"; function endpointsToMethods(octokit, endpointsMap) { const newMethods = {}; @@ -5737,7 +5741,7 @@ var pluginRequestLog = __nccwpck_require__(8883); var pluginPaginateRest = __nccwpck_require__(4193); 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({ userAgent: `octokit-rest.js/${VERSION}` @@ -9506,10 +9510,10 @@ module.exports = function (config) { }) return Q.all([ - readFile(__nccwpck_require__.ab + "template2.hbs", 'utf-8'), - readFile(__nccwpck_require__.ab + "header2.hbs", 'utf-8'), - readFile(__nccwpck_require__.ab + "commit2.hbs", 'utf-8'), - readFile(__nccwpck_require__.ab + "footer1.hbs", 'utf-8') + readFile(__nccwpck_require__.ab + "template1.hbs", 'utf-8'), + readFile(__nccwpck_require__.ab + "header1.hbs", 'utf-8'), + readFile(__nccwpck_require__.ab + "commit1.hbs", 'utf-8'), + readFile(__nccwpck_require__.ab + "footer.hbs", 'utf-8') ]) .spread((template, header, commit, footer) => { const writerOpts = getWriterOpts(config) @@ -9721,10 +9725,10 @@ function conventionalChangelogWriterInit (context, options) { includeDetails: false, ignoreReverted: true, doFlush: true, - mainTemplate: readFileSync(__nccwpck_require__.ab + "template1.hbs", 'utf-8'), - headerPartial: readFileSync(__nccwpck_require__.ab + "header1.hbs", 'utf-8'), - commitPartial: readFileSync(__nccwpck_require__.ab + "commit1.hbs", 'utf-8'), - footerPartial: readFileSync(__nccwpck_require__.ab + "footer.hbs", 'utf-8') + mainTemplate: readFileSync(__nccwpck_require__.ab + "template2.hbs", 'utf-8'), + headerPartial: readFileSync(__nccwpck_require__.ab + "header2.hbs", 'utf-8'), + commitPartial: readFileSync(__nccwpck_require__.ab + "commit2.hbs", 'utf-8'), + footerPartial: readFileSync(__nccwpck_require__.ab + "footer1.hbs", 'utf-8') }, options) if ((!_.isFunction(options.transform) && _.isObject(options.transform)) || _.isUndefined(options.transform)) { @@ -51104,6 +51108,7 @@ class ReleasePR { this.gh = options.github; this.changelogSections = options.changelogSections; this.changelogPath = (_b = options.changelogPath) !== null && _b !== void 0 ? _b : this.changelogPath; + this.pullRequestTitlePattern = options.pullRequestTitlePattern; } // A releaser can override this method to automatically detect the // packageName from source code (e.g. package.json "name") @@ -51221,14 +51226,14 @@ class ReleasePR { async buildPullRequestTitle(version, includePackageName) { const packageName = await this.getPackageName(); const pullRequestTitle = includePackageName - ? pull_request_title_1.PullRequestTitle.ofComponentVersion(packageName.name, version) - : pull_request_title_1.PullRequestTitle.ofVersion(version); + ? pull_request_title_1.PullRequestTitle.ofComponentVersion(packageName.name, version, this.pullRequestTitlePattern) + : pull_request_title_1.PullRequestTitle.ofVersion(version, this.pullRequestTitlePattern); return pullRequestTitle.toString(); } // Override this method to detect the release version from code (if it cannot be // inferred from the release PR head branch) detectReleaseVersionFromTitle(title) { - const pullRequestTitle = pull_request_title_1.PullRequestTitle.parse(title); + const pullRequestTitle = pull_request_title_1.PullRequestTitle.parse(title, this.pullRequestTitlePattern); if (pullRequestTitle) { return pullRequestTitle.getVersion(); } @@ -54716,11 +54721,11 @@ class ModuleVersion { this.packageName = options.packageName; } updateContent(content) { - const oldVersion = content.match(/v[0-9]\.[0-9]+\.[0-9](-\w+)?/); + const oldVersion = content.match(/v[0-9]+\.[0-9]+\.[0-9]+(-\w+)?/); if (oldVersion) { checkpoint_1.checkpoint(`updating ${this.path} from ${oldVersion} to v${this.version}`, checkpoint_1.CheckpointType.Success); } - return content.replace(/v[0-9]\.[0-9]+\.[0-9](-\w+)?/g, `v${this.version}`); + return content.replace(/v[0-9]+\.[0-9]+\.[0-9]+(-\w+)?/g, `v${this.version}`); } } exports.ModuleVersion = ModuleVersion; @@ -55106,42 +55111,69 @@ exports.indentCommit = indentCommit; // See the License for the specific language governing permissions and // limitations under the License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.PullRequestTitle = void 0; +exports.PullRequestTitle = exports.generateMatchPattern = void 0; // cannot import from '..' - transpiled code references to RELEASE_PLEASE // at the script level are undefined, they are only defined inside function // or instance methods/properties. -const DEFAULT_PATTERN = /^chore(\((?[\w-.]+)\))?: release ?(?[\w-.]*)? v?(?[0-9].*)$/; +const DEFAULT_PR_TITLE_PATTERN = 'chore${scope}: release${component} ${version}'; +function generateMatchPattern(pullRequestTitlePattern) { + if (pullRequestTitlePattern && + pullRequestTitlePattern.search(/\$\{scope\}/) === -1) + throw Error("pullRequestTitlePattern miss the part of '${scope}'"); + if (pullRequestTitlePattern && + pullRequestTitlePattern.search(/\$\{component\}/) === -1) + throw Error("pullRequestTitlePattern miss the part of '${component}'"); + if (pullRequestTitlePattern && + pullRequestTitlePattern.search(/\$\{version\}/) === -1) + throw Error("pullRequestTitlePattern miss the part of '${version}'"); + return new RegExp(`^${(pullRequestTitlePattern || DEFAULT_PR_TITLE_PATTERN) + .replace('${scope}', '(\\((?[\\w-.]+)\\))?') + .replace('${component}', ' ?(?[\\w-.]*)?') + .replace('${version}', 'v?(?[0-9].*)')}$`); +} +exports.generateMatchPattern = generateMatchPattern; class PullRequestTitle { constructor(opts) { this.version = opts.version; this.component = opts.component; this.targetBranch = opts.targetBranch; + this.pullRequestTitlePattern = + opts.pullRequestTitlePattern || DEFAULT_PR_TITLE_PATTERN; + this.matchPattern = generateMatchPattern(this.pullRequestTitlePattern); } - static parse(title) { - const match = title.match(DEFAULT_PATTERN); + static parse(title, pullRequestTitlePattern) { + const matchPattern = generateMatchPattern(pullRequestTitlePattern); + const match = title.match(matchPattern); if (match === null || match === void 0 ? void 0 : match.groups) { return new PullRequestTitle({ version: match.groups['version'], component: match.groups['component'], targetBranch: match.groups['branch'], + pullRequestTitlePattern: pullRequestTitlePattern, }); } return undefined; } - static create(_title) { - return undefined; - } - static ofComponentVersion(component, version) { - return new PullRequestTitle({ version, component }); + static ofComponentVersion(component, version, pullRequestTitlePattern) { + return new PullRequestTitle({ version, component, pullRequestTitlePattern }); } - static ofVersion(version) { - return new PullRequestTitle({ version }); + static ofVersion(version, pullRequestTitlePattern) { + return new PullRequestTitle({ version, pullRequestTitlePattern }); } - static ofTargetBranchVersion(targetBranch, version) { - return new PullRequestTitle({ version, targetBranch }); + static ofTargetBranchVersion(targetBranch, version, pullRequestTitlePattern) { + return new PullRequestTitle({ + version, + targetBranch, + pullRequestTitlePattern, + }); } - static ofComponentTargetBranchVersion(component, targetBranch, version) { - return new PullRequestTitle({ version, component, targetBranch }); + static ofComponentTargetBranchVersion(component, targetBranch, version, pullRequestTitlePattern) { + return new PullRequestTitle({ + version, + component, + targetBranch, + pullRequestTitlePattern, + }); } getTargetBranch() { return this.targetBranch; @@ -55155,7 +55187,10 @@ class PullRequestTitle { toString() { const scope = this.targetBranch ? `(${this.targetBranch})` : ''; const component = this.component ? ` ${this.component}` : ''; - return `chore${scope}: release${component} ${this.version}`; + return this.pullRequestTitlePattern + .replace('${scope}', scope) + .replace('${component}', component) + .replace('${version}', this.getVersion()); } } exports.PullRequestTitle = PullRequestTitle; @@ -66944,7 +66979,7 @@ module.exports = JSON.parse("{\"_args\":[[\"pino@6.11.1\",\"/home/runner/work/re /***/ ((module) => { "use strict"; -module.exports = {"i8":"11.0.1"}; +module.exports = {"i8":"11.1.0"}; /***/ }), diff --git a/dist/template1.hbs b/dist/template1.hbs index 2c1349a6..3b194f06 100644 --- a/dist/template1.hbs +++ b/dist/template1.hbs @@ -1,11 +1,23 @@ {{> header}} -{{#each commitGroups}} -{{#each commits}} -{{> commit root=@root}} +{{#if noteGroups}} +{{#each noteGroups}} + +### ⚠ {{title}} + +{{#each notes}} +* {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}} {{/each}} {{/each}} +{{/if}} +{{#each commitGroups}} -{{> footer}} +{{#if title}} +### {{title}} +{{/if}} +{{#each commits}} +{{> commit root=@root}} +{{/each}} +{{/each}} diff --git a/dist/template2.hbs b/dist/template2.hbs index 3b194f06..2c1349a6 100644 --- a/dist/template2.hbs +++ b/dist/template2.hbs @@ -1,23 +1,11 @@ {{> header}} -{{#if noteGroups}} -{{#each noteGroups}} - -### ⚠ {{title}} - -{{#each notes}} -* {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}} -{{/each}} -{{/each}} -{{/if}} {{#each commitGroups}} - -{{#if title}} -### {{title}} - -{{/if}} {{#each commits}} {{> commit root=@root}} {{/each}} - {{/each}} + +{{> footer}} + +