mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'dangerjs/mr_area_labels' into 'master'
add(ci:danger) Check MR area labels Closes IDF-7075 See merge request espressif/esp-idf!22845
This commit is contained in:
commit
005ba675f9
@ -9,7 +9,7 @@ async function runChecks() {
|
||||
// Checks for merge request description
|
||||
require("./mrDescriptionLongEnough.js")();
|
||||
require("./mrDescriptionHasReleaseNotes.js")();
|
||||
await require('./mrDescriptionJiraLinks.js')();
|
||||
await require("./mrDescriptionJiraLinks.js")();
|
||||
|
||||
// Checks for documentation
|
||||
require("./mrDocsTranslation.js")();
|
||||
@ -21,6 +21,9 @@ async function runChecks() {
|
||||
// Checks for MR code
|
||||
require("./mrSizeTooLarge.js")();
|
||||
|
||||
// Checks for MR area labels
|
||||
await require("./mrAreaLabels.js")();
|
||||
|
||||
// Add success log if no issues
|
||||
if (
|
||||
results.fails.length === 0 &&
|
||||
|
20
.gitlab/dangerjs/mrAreaLabels.js
Normal file
20
.gitlab/dangerjs/mrAreaLabels.js
Normal file
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Check if MR has area labels (light blue labels)
|
||||
*
|
||||
* @dangerjs WARN
|
||||
*/
|
||||
module.exports = async function () {
|
||||
const projectId = 103; // ESP-IDF
|
||||
const areaLabelColor = "#d2eBFA";
|
||||
const projectLabels = await danger.gitlab.api.Labels.all(projectId); // Get all project labels
|
||||
const areaLabels = projectLabels
|
||||
.filter((label) => label.color === areaLabelColor)
|
||||
.map((label) => label.name); // Filter only area labels
|
||||
const mrLabels = danger.gitlab.mr.labels; // Get MR labels
|
||||
|
||||
if (!mrLabels.some((label) => areaLabels.includes(label))) {
|
||||
warn(
|
||||
`Please add some [area labels](${process.env.DANGER_GITLAB_HOST}/espressif/esp-idf/-/labels) to this MR.`
|
||||
);
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user