Merge pull request #6692 from vector-im/feature/bma/no_signoff_dependabot
No signoff, no changelog for dependabot's PR
This commit is contained in:
commit
5d30026726
@ -8,6 +8,8 @@ const {danger, warn} = require('danger')
|
|||||||
// warn(JSON.stringify(danger))
|
// warn(JSON.stringify(danger))
|
||||||
|
|
||||||
const pr = danger.github.pr
|
const pr = danger.github.pr
|
||||||
|
// User who has created the PR.
|
||||||
|
const user = pr.user.login
|
||||||
const modified = danger.git.modified_files
|
const modified = danger.git.modified_files
|
||||||
const created = danger.git.created_files
|
const created = danger.git.created_files
|
||||||
let editedFiles = [...modified, ...created]
|
let editedFiles = [...modified, ...created]
|
||||||
@ -19,15 +21,22 @@ if (pr.body.length == 0) {
|
|||||||
|
|
||||||
// Warn when there is a big PR
|
// Warn when there is a big PR
|
||||||
if (editedFiles.length > 50) {
|
if (editedFiles.length > 50) {
|
||||||
warn("This pull request seems relatively large. Please consider splitting it into multiple smaller ones.")
|
message("This pull request seems relatively large. Please consider splitting it into multiple smaller ones.")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Request a changelog for each PR
|
// Request a changelog for each PR
|
||||||
let changelogFiles = editedFiles.filter(file => file.startsWith("changelog.d/"))
|
const changelogAllowList = [
|
||||||
|
"dependabot[bot]",
|
||||||
|
]
|
||||||
|
|
||||||
if (changelogFiles.length == 0) {
|
let requiresChangelog = !changelogAllowList.includes(user)
|
||||||
|
|
||||||
|
if (requiresChangelog) {
|
||||||
|
let changelogFiles = editedFiles.filter(file => file.startsWith("changelog.d/"))
|
||||||
|
|
||||||
|
if (changelogFiles.length == 0) {
|
||||||
warn("Please add a changelog. See instructions [here](https://github.com/vector-im/element-android/blob/develop/CONTRIBUTING.md#changelog)")
|
warn("Please add a changelog. See instructions [here](https://github.com/vector-im/element-android/blob/develop/CONTRIBUTING.md#changelog)")
|
||||||
} else {
|
} else {
|
||||||
const validTowncrierExtensions = [
|
const validTowncrierExtensions = [
|
||||||
"bugfix",
|
"bugfix",
|
||||||
"doc",
|
"doc",
|
||||||
@ -39,6 +48,7 @@ if (changelogFiles.length == 0) {
|
|||||||
if (!changelogFiles.every(file => validTowncrierExtensions.includes(file.split(".").pop()))) {
|
if (!changelogFiles.every(file => validTowncrierExtensions.includes(file.split(".").pop()))) {
|
||||||
fail("Invalid extension for changelog. See instructions [here](https://github.com/vector-im/element-android/blob/develop/CONTRIBUTING.md#changelog)")
|
fail("Invalid extension for changelog. See instructions [here](https://github.com/vector-im/element-android/blob/develop/CONTRIBUTING.md#changelog)")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for a sign-off
|
// Check for a sign-off
|
||||||
@ -50,6 +60,7 @@ const allowList = [
|
|||||||
"BillCarsonFr",
|
"BillCarsonFr",
|
||||||
"bmarty",
|
"bmarty",
|
||||||
"Claire1817",
|
"Claire1817",
|
||||||
|
"dependabot[bot]",
|
||||||
"ericdecanini",
|
"ericdecanini",
|
||||||
"fedrunov",
|
"fedrunov",
|
||||||
"Florian14",
|
"Florian14",
|
||||||
@ -65,7 +76,7 @@ const allowList = [
|
|||||||
"yostyle",
|
"yostyle",
|
||||||
]
|
]
|
||||||
|
|
||||||
let requiresSignOff = !allowList.includes(pr.user.login)
|
let requiresSignOff = !allowList.includes(user)
|
||||||
|
|
||||||
if (requiresSignOff) {
|
if (requiresSignOff) {
|
||||||
let hasPRBodySignOff = pr.body.includes(signOff)
|
let hasPRBodySignOff = pr.body.includes(signOff)
|
||||||
@ -91,5 +102,5 @@ if (hasPngs) {
|
|||||||
|
|
||||||
// Check for reviewers
|
// Check for reviewers
|
||||||
if (pr.requested_reviewers.length == 0 && !pr.draft) {
|
if (pr.requested_reviewers.length == 0 && !pr.draft) {
|
||||||
fail("Please add a reviewer to your PR.")
|
warn("Please add a reviewer to your PR.")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user