esp-idf/.gitlab/dangerjs/mrTitleNoDraftOrWip.js
Tomas Sebestik 7c58a38e88 Add improved check for Jira links
Break DangerJS checks to modules
Improove "Release notes" section detection
Change check for size MR to async/await syntax
Update check for MR title - exact match WIP and DRAFT
Add check for incorrect format closing Jira link
Update check WIP in MR title
2023-03-06 13:43:25 +01:00

23 lines
652 B
JavaScript

/**
* Check if MR Title contains prefix "WIP: ...".
*
* @dangerjs WARN
*/
module.exports = function () {
const mrTitle = danger.gitlab.mr.title;
const regexes = [
{ prefix: 'WIP', regex: /^WIP:/i },
{ prefix: 'W.I.P', regex: /^W\.I\.P/i },
{ prefix: '[WIP]', regex: /^\[WIP/i },
{ prefix: '[W.I.P]', regex: /^\[W\.I\.P/i },
{ prefix: '(WIP)', regex: /^\(WIP/i },
{ prefix: '(W.I.P)', regex: /^\(W\.I\.P/i },
];
for (const item of regexes) {
if (item.regex.test(mrTitle)) {
return warn(`Please remove the \`${item.prefix}\` prefix from the MR name before merging this MR.`);
}
}
};