-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: resolve commit message issue (#423)
- Loading branch information
Showing
3 changed files
with
58 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,24 @@ | ||
function generateValidProfileLink(blog, githubProfileURL) { | ||
const validRegexWithScheme = /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/ | ||
const validRegexWithoutScheme = /^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/ | ||
if (validRegexWithScheme.test(blog)) return blog; | ||
if (validRegexWithoutScheme.test(blog)) return `http://${blog}`; | ||
if (validRegexWithScheme.test(blog)) return blog; | ||
return githubProfileURL || '' | ||
} | ||
|
||
function generatePrTitle(message, contributions) { | ||
const contributionsTitlePartLimit = 3 | ||
|
||
let contributionsTitlePartText = contributions.join(', ') | ||
|
||
const arr = contributions.slice(0, contributionsTitlePartLimit); | ||
if (contributions.length > contributionsTitlePartLimit) arr[arr.length - 1] = `${contributions.length - 2} more` | ||
if (arr.length > 1) contributionsTitlePartText = arr.slice(0, arr.length - 1).join(', ') + ", and " + arr.slice(-1); | ||
|
||
return [message, `for ${contributionsTitlePartText}`].join(' ') | ||
} | ||
|
||
module.exports = { | ||
generatePrTitle, | ||
generateValidProfileLink | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89953af
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
app – ./
app-git-master-all-contributors.vercel.app
all-contributors.vercel.app
app-all-contributors.vercel.app
all-contributors-app.vercel.app