Skip to content

Commit

Permalink
Include the commit message conditionally (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospassos authored Mar 24, 2022
1 parent 0f74758 commit bfc88d5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,9 @@ function getCommitMessage(mergeCommitMessage, pullRequest) {
} else if (mergeCommitMessage === "pull-request-description") {
return pullRequest.body;
} else if (mergeCommitMessage === "pull-request-title-and-description") {
return pullRequest.title + "\n\n" + pullRequest.body;
return (
pullRequest.title + (pullRequest.body ? "\n\n" + pullRequest.body : "")
);
} else {
return mergeCommitMessage.replace(PR_PROPERTY, (_, prProp) =>
resolvePath(pullRequest, prProp)
Expand Down Expand Up @@ -22088,7 +22090,7 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"]
/***/ ((module) => {

"use strict";
module.exports = JSON.parse('{"name":"automerge-action","version":"0.15.0","description":"GitHub action to automatically merge pull requests","main":"lib/api.js","author":"Pascal","license":"MIT","private":true,"bin":{"automerge-action":"./bin/automerge.js"},"scripts":{"test":"jest","it":"node it/it.js","lint":"prettier -l lib/** test/** && eslint .","compile":"ncc build bin/automerge.js --license LICENSE -o dist","prepublish":"yarn lint && yarn test && yarn compile"},"dependencies":{"@actions/core":"^1.6.0","@octokit/rest":"^18.12.0","argparse":"^2.0.1","fs-extra":"^10.0.1","object-resolve-path":"^1.1.1","tmp":"^0.2.1"},"devDependencies":{"@vercel/ncc":"^0.33.3","dotenv":"^16.0.0","eslint":"^8.11.0","eslint-plugin-jest":"^26.1.3","jest":"^27.5.1","prettier":"^2.6.0"},"prettier":{"trailingComma":"none","arrowParens":"avoid"}}');
module.exports = JSON.parse('{"name":"automerge-action","version":"0.15.1","description":"GitHub action to automatically merge pull requests","main":"lib/api.js","author":"Pascal","license":"MIT","private":true,"bin":{"automerge-action":"./bin/automerge.js"},"scripts":{"test":"jest","it":"node it/it.js","lint":"prettier -l lib/** test/** && eslint .","compile":"ncc build bin/automerge.js --license LICENSE -o dist","prepublish":"yarn lint && yarn test && yarn compile"},"dependencies":{"@actions/core":"^1.6.0","@octokit/rest":"^18.12.0","argparse":"^2.0.1","fs-extra":"^10.0.1","object-resolve-path":"^1.1.1","tmp":"^0.2.1"},"devDependencies":{"@vercel/ncc":"^0.33.3","dotenv":"^16.0.0","eslint":"^8.11.0","eslint-plugin-jest":"^26.1.3","jest":"^27.5.1","prettier":"^2.6.0"},"prettier":{"trailingComma":"none","arrowParens":"avoid"}}');

/***/ })

Expand Down
4 changes: 3 additions & 1 deletion lib/merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,9 @@ function getCommitMessage(mergeCommitMessage, pullRequest) {
} else if (mergeCommitMessage === "pull-request-description") {
return pullRequest.body;
} else if (mergeCommitMessage === "pull-request-title-and-description") {
return pullRequest.title + "\n\n" + pullRequest.body;
return (
pullRequest.title + (pullRequest.body ? "\n\n" + pullRequest.body : "")
);
} else {
return mergeCommitMessage.replace(PR_PROPERTY, (_, prProp) =>
resolvePath(pullRequest, prProp)
Expand Down

0 comments on commit bfc88d5

Please sign in to comment.