-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/danger_commit_email' into 'master'
ci: danger: check author/committer email Closes IDF-6860 See merge request espressif/esp-idf!22646
- Loading branch information
Showing
2 changed files
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.` | ||
); | ||
} | ||
}; |