From fd3c8a0d3e1c24f6db8afb48f358d4cbfb1498a8 Mon Sep 17 00:00:00 2001 From: Tomas Sebestik Date: Tue, 28 Feb 2023 08:15:21 +0100 Subject: [PATCH 1/2] Fix DangerJS check for MR title - exact match WIP and DRAFT --- .gitlab/dangerfile.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitlab/dangerfile.js b/.gitlab/dangerfile.js index 945360e3e4..01f8477528 100644 --- a/.gitlab/dangerfile.js +++ b/.gitlab/dangerfile.js @@ -8,8 +8,11 @@ import { danger, warn, message, results } from "danger" function checkMrTitle() { const mrTitle = danger.gitlab.mr.title - if (mrTitle.toUpperCase().includes("WIP") || mrTitle.toUpperCase().includes("DRAFT")) { - return warn("Please remove the `WIP:`/`Draft:` prefix from the MR name before merging this MR."); + const regexWip = /^WIP:/i; + const regexDraft = /^DRAFT:/i; + + if ((regexWip.test(mrTitle)) || (regexDraft.test(mrTitle))) { + return warn("Please remove the `WIP:`/`DRAFT:` prefix from the MR name before merging this MR."); } } checkMrTitle(); From 4ebab0c28efb1f66b8ebfdec631be38030ba8a14 Mon Sep 17 00:00:00 2001 From: Tomas Sebestik Date: Tue, 28 Feb 2023 09:42:07 +0100 Subject: [PATCH 2/2] Reformulated "missing JIRA links" message --- .gitlab/dangerfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/dangerfile.js b/.gitlab/dangerfile.js index 01f8477528..fab333205d 100644 --- a/.gitlab/dangerfile.js +++ b/.gitlab/dangerfile.js @@ -75,7 +75,7 @@ function checkMrJiraLinks() { } if (!mrDescription.toUpperCase().includes("## RELATED") || !testJiraLabels) { // Missing section "Related" or missing links to JIRA tickets - return warn("Please add links to JIRA issues to the MR description section `Related`."); + return message("Please consider adding references to JIRA issues in the `Related` section of the MR description."); } else if (ghIssueTicket) { // Found JIRA ticket linked GitHub issue if (!testGithubLink.test(mrCommitMessages)) { // Commit message does not contain a link to close the issue on GitHub