mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
7c58a38e88
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
29 lines
1.0 KiB
JavaScript
29 lines
1.0 KiB
JavaScript
/**
|
|
* Check if MR Description contains mandatory section "Release notes"
|
|
*
|
|
* Extracts the content of the "Release notes" section from the GitLab merge request description.
|
|
*
|
|
* @dangerjs WARN (if section missing, is empty or wrong markdown format)
|
|
*/
|
|
module.exports = function () {
|
|
const mrDescription = danger.gitlab.mr.description;
|
|
const regexSectionReleaseNotes = /## Release notes([\s\S]*?)(?=## |$)/;
|
|
const sectionReleaseNotes = mrDescription.match(regexSectionReleaseNotes);
|
|
|
|
if (!sectionReleaseNotes) {
|
|
warn(
|
|
'The `Release Notes` section seems to be missing. Please check if the section header in MR description is present and in the correct markdown format ("## Release Notes")\n'
|
|
);
|
|
return null;
|
|
}
|
|
|
|
let content = sectionReleaseNotes[1].replace(/(\r\n|\n|\r)/gm, "").trim(); // Remove empty lines and whitespace
|
|
|
|
if (!content.length) {
|
|
warn(
|
|
"The `Release Notes` section seems to be empty (no section content)\n"
|
|
);
|
|
return null;
|
|
}
|
|
};
|