From 59d9ef739c46ab88ef2fca5563817af95a9195c0 Mon Sep 17 00:00:00 2001 From: Xander Marjoram Date: Wed, 10 Jul 2024 16:09:32 +0100 Subject: [PATCH] chore(pie-monorepo): DSW-000 update commit message verification to allow merge commits (#1586) * chore(pie-monorepo): DSW-000 test message * chore(pie-monorepo): DSW-000 update commit message verification to allow merge commits * Update regex and matcher logic --- package.json | 2 +- .../tools/pie-git-hooks-scripts/git-hooks-utils.js | 3 +++ yarn.lock | 10 +++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 973d8050ec..00b7a7d0cb 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,7 @@ "commitizen": "4.3.0", "cross-env": "7.0.3", "cssnano": "5.1.15", - "cz-customizable": "7.0.0", + "cz-customizable": "7.1.0", "danger": "11.3.0", "dree": "3.4.5", "eslint": "8.37.0", diff --git a/packages/tools/pie-git-hooks-scripts/git-hooks-utils.js b/packages/tools/pie-git-hooks-scripts/git-hooks-utils.js index 7e423d6e6e..19069bf584 100644 --- a/packages/tools/pie-git-hooks-scripts/git-hooks-utils.js +++ b/packages/tools/pie-git-hooks-scripts/git-hooks-utils.js @@ -39,6 +39,9 @@ function verifyCommitMessage (commitMessage, ticketId) { // Process commit message and check if it already has a ticket id const match = commitMessage.match(/^(\w*)\((\w.*)\): (\w+?-\d{1,7}) (\w.*)/); + const isMergeCommit = commitMessage.trim().match(/^Merge branch '[\w-]+' into [\w-]+\n?/); + if (isMergeCommit !== null) return commitMessage.trim(); + // If the commit message doesn't have a ticket id, extract the existing message parts and add the ticket id if (!match) { const commitMessageParts = commitMessage.match(/^(\w*)\((\w.*)\): (\w.*)/); diff --git a/yarn.lock b/yarn.lock index 16ab3d7682..99af8cfabf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17593,9 +17593,9 @@ __metadata: languageName: node linkType: hard -"cz-customizable@npm:7.0.0": - version: 7.0.0 - resolution: "cz-customizable@npm:7.0.0" +"cz-customizable@npm:7.1.0": + version: 7.1.0 + resolution: "cz-customizable@npm:7.1.0" dependencies: editor: 1.0.0 find-config: ^1.0.0 @@ -17606,7 +17606,7 @@ __metadata: bin: cz-cust: standalone.js cz-customizable: standalone.js - checksum: 657ae421f9b21c5c4168cad518089780f9a3ce7501cbeea8b8d652ff7ed6ba0fdf9532ca9ca0d025c11520ba4be878bc828d2bd84d1d4484bbb66031d055f95a + checksum: b8ce92e6aa84fb0c2d921d9cc676b032e12176fd850e384a71a9a6cf21d079d731d8b5364ad0aeb894df4538b0fee091cd21710900c005679646706cda3049b6 languageName: node linkType: hard @@ -29571,7 +29571,7 @@ __metadata: commitizen: 4.3.0 cross-env: 7.0.3 cssnano: 5.1.15 - cz-customizable: 7.0.0 + cz-customizable: 7.1.0 danger: 11.3.0 dree: 3.4.5 eslint: 8.37.0