diff --git a/src/index.js b/src/index.js index f87d4f35d..0686bda28 100644 --- a/src/index.js +++ b/src/index.js @@ -97,6 +97,14 @@ module.exports = async function run() { `Pull request has only one commit and it's not semantic; this may lead to a non-semantic commit in the base branch (see https://github.community/t/how-to-change-the-default-squash-merge-commit-message/1155). Amend the commit message to match the pull request title, or add another commit.` ); } + + const commitTitle = + nonMergeCommits[0].commit.message.split('\n')[0]; + if (commitTitle !== pullRequest.title) { + throw new Error( + `The pull request has only one (non-merge) commit and in this case Github will use it as the default commit message when merging. The pull request title doesn't match the commit though ("${pullRequest.title}" vs. "${commitTitle}"). Please update the pull request title accordingly to avoid surprises.` + ); + } } } } catch (error) {