Skip to content

Commit

Permalink
Adding pretified Release data in the Releases (#158)
Browse files Browse the repository at this point in the history
* Adding pretified Release data in the Releases

* Updating GitHub Action
  • Loading branch information
danitseitlin committed Apr 9, 2022
1 parent 03838ab commit 954a2cd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
26 changes: 12 additions & 14 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5194,7 +5194,7 @@ async function configureGitHub(pkgName) {
*/
async function releaseGitHubVersion(data) {
const tagName = `v${data.version}`;
let body = `${tagName} Release\n`;
let body = '';
if(data.commits && data.commits.length > 0) {
const commitsByAuthor = getCommitsByAuthor(data.commits)
body+= buildBodyCommitMessage(commitsByAuthor)
Expand All @@ -5216,26 +5216,24 @@ async function releaseGitHubVersion(data) {
}
}
function getCommitsByAuthor(commits) {
const commitsByAuthor = {}
const commitsByAuthor = []
for(const commit of commits) {
const author = commit.commit.author.name;
const message = commit.commit.message;
//If any commits for the author we're already added, it would be an array and we would push into it
if(commitsByAuthor[author]) {
commitsByAuthor[author].push(message)
}
else {
commitsByAuthor[author] = [message]
let message = commit.commit.message;
if(message.indexOf('\n') != -1){
message = message.split('\n')[0]
}
commitsByAuthor.push({
author: author,
message: message
})
}
return commitsByAuthor
}
function buildBodyCommitMessage(commitsByAuthor) {
let body = "Commits:\n";
for(const author in commitsByAuthor) {
const commitList = `${commitsByAuthor[author]}`.split(',').join(`\n`)
body += `Commited by ${author}:\n`
body += `${commitList}\n`
let body = "<h2>Commits:</h2>\n";
for(const commit of commitsByAuthor) {
body += `${commit.message} by @${commit.author}\n`
}
return body
}
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
"pre-deploy": "npm run build && npm run clean",
"deploy": "deploy-pkg package-deployer",
"clean": "rmdir lib /s/q && rmdir dist /s/q",
"action-build": "export NODE_OPTIONS=--openssl-legacy-provider && ncc build action.index.js -o dist && git add ./dist/index.js && git add ./action.index.js && git add ./action.yml && git commit -m \"Updating GitHub Action\"",
"action-build-mac": "export NODE_OPTIONS=--openssl-legacy-provider && ncc build action.index.js -o dist && git add ./dist/index.js && git add ./action.index.js && git add ./action.yml && git commit -m \"Updating GitHub Action\"",
"pkg-build": "export NODE_OPTIONS=--openssl-legacy-provider && ncc build npm.index.js -o lib",
"build-and-commit": "git add . && rmdir dist /s/q && npm run action-build && git push origin HEAD"
"build-and-commit-mac": "git add . && rmdir dist /s/q && npm run action-build-mac && git push origin HEAD",
"action-build-win": "ncc build action.index.js -o dist && git add ./dist/index.js && git add ./action.index.js && git add ./action.yml && git commit -m \"Updating GitHub Action\"",
"build-and-commit": "git add . && rmdir dist /s/q && npm run action-build-win && git push origin HEAD"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 954a2cd

Please sign in to comment.