mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-26 18:58:21 +02:00
Tools: Display commit in changelog when a pull request is not available
This commit is contained in:
parent
43feb1ea7e
commit
bafa5053fd
@ -124,7 +124,7 @@ function filterLogs(logs, platform) {
|
||||
return output;
|
||||
}
|
||||
|
||||
function formatCommitMessage(msg, author, options) {
|
||||
function formatCommitMessage(commit, msg, author, options) {
|
||||
options = Object.assign({}, { publishFormat: 'full' }, options);
|
||||
|
||||
let output = '';
|
||||
@ -234,6 +234,8 @@ function formatCommitMessage(msg, author, options) {
|
||||
|
||||
output = messagePieces.join(': ');
|
||||
|
||||
const issueRegex = /\((#[0-9]+)\)$/;
|
||||
|
||||
if (options.publishFormat === 'full') {
|
||||
if (commitMessage.issueNumber) {
|
||||
const formattedIssueNum = `(#${commitMessage.issueNumber})`;
|
||||
@ -251,13 +253,19 @@ function formatCommitMessage(msg, author, options) {
|
||||
}
|
||||
}
|
||||
|
||||
if (authorMd) {
|
||||
output = output.replace(/\((#[0-9]+)\)$/, `($1 by ${authorMd})`);
|
||||
if (output.match(issueRegex)) {
|
||||
if (authorMd) {
|
||||
output = output.replace(issueRegex, `($1 by ${authorMd})`);
|
||||
}
|
||||
} else {
|
||||
const commitStrings = [commit.substr(0, 7)];
|
||||
if (authorMd) commitStrings.push(`by ${authorMd}`);
|
||||
output += ` (${commitStrings.join(' ')})`;
|
||||
}
|
||||
}
|
||||
|
||||
if (options.publishFormat !== 'full') {
|
||||
output = output.replace(/\((#[0-9]+)\)$/, '');
|
||||
output = output.replace(issueRegex, '');
|
||||
}
|
||||
|
||||
return escapeHtml(output);
|
||||
@ -267,7 +275,7 @@ function createChangeLog(logs, options) {
|
||||
const output = [];
|
||||
|
||||
for (const log of logs) {
|
||||
output.push(formatCommitMessage(log.message, log.author, options));
|
||||
output.push(formatCommitMessage(log.commit, log.message, log.author, options));
|
||||
}
|
||||
|
||||
return output;
|
||||
|
Loading…
x
Reference in New Issue
Block a user