From 096e368a063e58c85a39f11e59ab0972f419d7bb Mon Sep 17 00:00:00 2001 From: Samuel Kopp <62482066+boywithkeyboard@users.noreply.github.com> Date: Sun, 10 Sep 2023 13:11:01 +0200 Subject: [PATCH] refactor: make commit message bold (#27) --- action.js | 8 +++++--- action.ts | 9 ++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/action.js b/action.js index 873647b..fb0b417 100644 --- a/action.js +++ b/action.js @@ -21034,7 +21034,7 @@ async function action() { return commit } const i = c.data.commit.message.indexOf(')\n\n') - const title = c.data.commit.message.substring(0, i > 0 ? i + 1 : void 0) + let title = c.data.commit.message.substring(0, i > 0 ? i + 1 : void 0) const comments = (await rest.issues.listComments({ ...import_github.context.repo, issue_number: number, @@ -21050,8 +21050,10 @@ async function action() { ) { continue } + title = linkifyReferences(title) + title = title.replace(': ', ': **').replace(' ([#', '** ([#') releaseBody += ` -* ${linkifyReferences(title)}` +* ${title}` if (config.includeAuthor && user?.login) { contributors.add(`, @${user.login}`) releaseBody += ` by @${user.login}` @@ -21071,7 +21073,7 @@ ${indentString(body, 2)} : arr[arr.length - 1].replace(', ', ' & ') releaseBody += ` -###### Contributed by ${arr.join('')}` +Contributed by ${arr.join('')}` } const { data: release } = await rest.repos.createRelease({ owner: import_github.context.repo.owner, diff --git a/action.ts b/action.ts index 6409146..b6977ab 100644 --- a/action.ts +++ b/action.ts @@ -212,7 +212,7 @@ async function action() { } const i = c.data.commit.message.indexOf(')\n\n') - const title = c.data.commit.message.substring(0, i > 0 ? i + 1 : undefined) + let title = c.data.commit.message.substring(0, i > 0 ? i + 1 : undefined) const comments = (await rest.issues.listComments({ ...context.repo, @@ -230,9 +230,12 @@ async function action() { continue } + title = linkifyReferences(title) + title = title.replace(': ', ': **').replace(' ([#', '** ([#') + // changelogBody += `\n* ${linkifyReferences(title)}` - releaseBody += `\n* ${linkifyReferences(title)}` + releaseBody += `\n* ${title}` if (config.includeAuthor && user?.login) { // changelogBody += user?.login @@ -257,7 +260,7 @@ async function action() { ? arr[arr.length - 1].replace(', ', ', & ') : arr[arr.length - 1].replace(', ', ' & ') - releaseBody += `\n\n###### Contributed by ${arr.join('')}` + releaseBody += `\n\nContributed by ${arr.join('')}` } const { data: release } = await rest.repos.createRelease({