Fix
This commit is contained in:
parent
60de93354b
commit
893c95fd77
1 changed files with 30 additions and 21 deletions
|
|
@ -88,27 +88,8 @@ const allowList = [
|
||||||
"yostyle",
|
"yostyle",
|
||||||
]
|
]
|
||||||
|
|
||||||
// We ignore signoff requirements for employees of Element
|
function signoff_needed(reason) {
|
||||||
// as copyright assignment is covered by our employee contracts.
|
message("Sign-off required, " + reason)
|
||||||
|
|
||||||
var memberOfElement
|
|
||||||
|
|
||||||
try {
|
|
||||||
github.api.rest.orgs.checkPublicMembership({
|
|
||||||
org: "vector-im",
|
|
||||||
username: user
|
|
||||||
})
|
|
||||||
memberOfElement = true
|
|
||||||
} catch (err) {
|
|
||||||
// Raises an error if 404 is returned = not member
|
|
||||||
memberOfElement = false
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const requiresSignOff = !allowList.includes(user) || !memberOfElement
|
|
||||||
|
|
||||||
if (requiresSignOff) {
|
|
||||||
const hasPRBodySignOff = pr.body.includes(signOff)
|
const hasPRBodySignOff = pr.body.includes(signOff)
|
||||||
const hasCommitSignOff = danger.git.commits.every(commit => commit.message.includes(signOff))
|
const hasCommitSignOff = danger.git.commits.every(commit => commit.message.includes(signOff))
|
||||||
if (!hasPRBodySignOff && !hasCommitSignOff) {
|
if (!hasPRBodySignOff && !hasCommitSignOff) {
|
||||||
|
|
@ -116,6 +97,34 @@ if (requiresSignOff) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function signoff_unneeded(reason) {
|
||||||
|
message("Sign-off not required, " + reason)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Somewhat awkward phrasing, dangerfile is not in an async context.
|
||||||
|
if (allowList.includes(user)) {
|
||||||
|
signoff_unneeded("allow-list")
|
||||||
|
} else {
|
||||||
|
github.api.rest.orgs.checkMembershipForUser({
|
||||||
|
org: "vector-im",
|
||||||
|
username: user,
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.status == 204) {
|
||||||
|
signoff_unneeded("org-member")
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
signoff_needed("not-org-member")
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
if (error.response.status == 404) {
|
||||||
|
signoff_needed("not-org-member");
|
||||||
|
} else {
|
||||||
|
console.log(error); signoff_needed("error")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check for screenshots on view changes
|
// Check for screenshots on view changes
|
||||||
const hasChangedViews = editedFiles.filter(file => file.includes("/layout")).length > 0
|
const hasChangedViews = editedFiles.filter(file => file.includes("/layout")).length > 0
|
||||||
if (hasChangedViews) {
|
if (hasChangedViews) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue