ci: danger: check author/committer email

pull/11189/head
Ivan Grokhotkov 2023-03-08 00:02:37 +01:00
rodzic 2ffd3cef70
commit eb3b2b5a63
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 1E050E141B280628
2 zmienionych plików z 17 dodań i 0 usunięć

Wyświetl plik

@ -17,6 +17,7 @@ async function runChecks() {
// Checks for MR commits
require("./mrCommitsTooManyCommits.js")();
require("./mrCommitsCommitMessage.js")();
require("./mrCommitsEmail.js")();
// Checks for MR code
require("./mrSizeTooLarge.js")();

Wyświetl plik

@ -0,0 +1,16 @@
/**
* Check if the author is accidentally making a commit using a personal email
*
* @dangerjs INFO
*/
module.exports = function () {
const mrCommitAuthorEmails = danger.gitlab.commits.map(commit => commit.author_email);
const mrCommitCommitterEmails = danger.gitlab.commits.map(commit => commit.committer_email);
const emailPattern = /.*@espressif\.com/;
const filteredEmails = [...mrCommitAuthorEmails, ...mrCommitCommitterEmails].filter((email) => !emailPattern.test(email));
if (filteredEmails.length) {
return message(
`Some of the commits were authored or committed by developers outside Espressif: ${filteredEmails.join(', ')}. Please check if this is expected.`
);
}
};