Skip to content

Commit

Permalink
refactor: edit style of new option
Browse files Browse the repository at this point in the history
  • Loading branch information
boywithkeyboard committed Aug 30, 2023
1 parent f3dcaac commit 5c5cfdc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
9 changes: 7 additions & 2 deletions action.js
Original file line number Diff line number Diff line change
Expand Up @@ -21053,7 +21053,7 @@ async function action() {
releaseBody += `
* ${linkifyReferences(title)}`
if (config.includeAuthor && user?.login) {
contributors.add(`@${user.login}`)
contributors.add(`, @${user.login}`)
releaseBody += ` by @${user.login}`
}
if (config.includeDescription && body !== null && body.length > 0) {
Expand All @@ -21064,9 +21064,14 @@ ${indentString(body, 2)}
}
}
if (config.mentionContributors) {
const arr = [...contributors.values()]
arr[0] = arr[0].replace(', ', '')
arr[arr.length - 1] = arr.length > 2
? arr[arr.length - 1].replace(', ', ', & ')
: arr[arr.length - 1].replace(', ', ' & ')
releaseBody += `

${[...contributors.values()].join(' ')}`
###### Contributed by ${arr.join('')}`
}
const { data: release } = await rest.repos.createRelease({
owner: import_github.context.repo.owner,
Expand Down
11 changes: 9 additions & 2 deletions action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ async function action() {
// ? ` by [@${user?.login}](https://github.com/${user?.login})`
// : ''

contributors.add(`@${user.login}`)
contributors.add(`, @${user.login}`)
releaseBody += ` by @${user.login}`
}

Expand All @@ -250,7 +250,14 @@ async function action() {
}

if (config.mentionContributors) {
releaseBody += `\n\n${[...contributors.values()].join(' ')}`
const arr = [...contributors.values()]

arr[0] = arr[0].replace(', ', '')
arr[arr.length - 1] = arr.length > 2
? arr[arr.length - 1].replace(', ', ', & ')
: arr[arr.length - 1].replace(', ', ' & ')

releaseBody += `\n\n###### Contributed by ${arr.join('')}`
}

const { data: release } = await rest.repos.createRelease({
Expand Down

0 comments on commit 5c5cfdc

Please sign in to comment.