esp-idf/.gitlab/dangerjs/mrCommitsTooManyCommits.js
2023-03-13 08:36:05 +01:00

16 lines
477 B
JavaScript

/**
* Check if MR has not an excessive numbers of commits (if squashed)
*
* @dangerjs INFO
*/
module.exports = function () {
const tooManyCommitThreshold = 2; // above this number of commits, squash commits is suggested
const mrCommits = danger.gitlab.commits;
if (mrCommits.length > tooManyCommitThreshold) {
return message(
`You might consider squashing your ${mrCommits.length} commits (simplifying branch history).`
);
}
};