Merge pull request #4037 from element-hq/feature/bma/pullRequestTemplate
Update pull request template and CI automation
This commit is contained in:
@@ -48,72 +48,6 @@ frozenClasses.forEach(frozen => {
|
||||
}
|
||||
)
|
||||
|
||||
// Check for a sign-off
|
||||
const signOff = "Signed-off-by:"
|
||||
|
||||
// Please add new names following the alphabetical order.
|
||||
const allowList = [
|
||||
"aringenbach",
|
||||
"BillCarsonFr",
|
||||
"bmarty",
|
||||
"csmith",
|
||||
"dependabot[bot]",
|
||||
"Florian14",
|
||||
"ganfra",
|
||||
"github-actions[bot]",
|
||||
"jmartinesp",
|
||||
"jonnyandrew",
|
||||
"julioromano",
|
||||
"kittykat",
|
||||
"langleyd",
|
||||
"MadLittleMods",
|
||||
"manuroe",
|
||||
"renovate[bot]",
|
||||
"stefanceriu",
|
||||
"yostyle",
|
||||
]
|
||||
|
||||
function signoff_needed(reason) {
|
||||
message("Sign-off required, " + reason)
|
||||
const hasPRBodySignOff = pr.body.includes(signOff)
|
||||
const hasCommitSignOff = danger.git.commits.every(commit => commit.message.includes(signOff))
|
||||
if (!hasPRBodySignOff && !hasCommitSignOff) {
|
||||
fail("Please add a sign-off to either the PR description or to the commits themselves. See instructions [here](https://matrix-org.github.io/synapse/latest/development/contributing_guide.html#sign-off).")
|
||||
}
|
||||
}
|
||||
|
||||
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: "element-hq",
|
||||
// username: user,
|
||||
// }).then((result) => {
|
||||
github.api.rest.teams.getMembershipForUserInOrg({
|
||||
org: "element-hq",
|
||||
team_slug: "vector-core",
|
||||
username: user,
|
||||
}).then((result) => {
|
||||
if (result.status == 204 || result.status == 200) {
|
||||
signoff_unneeded("team-member")
|
||||
}
|
||||
else {
|
||||
signoff_needed("not-team-member")
|
||||
}
|
||||
}).catch((error) => {
|
||||
if (error.response.status == 404) {
|
||||
signoff_needed("not-team-member");
|
||||
} else {
|
||||
console.log(error); signoff_needed("error")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const previewAnnotations = [
|
||||
'androidx.compose.ui.tooling.preview.Preview',
|
||||
'io.element.android.libraries.designsystem.preview.PreviewWithLargeHeight',
|
||||
@@ -170,17 +104,11 @@ if (hasPngs) {
|
||||
|
||||
// Check that translations have not been modified by developers
|
||||
const translationAllowList = [
|
||||
"RiotTranslateBot",
|
||||
"github-actions[bot]",
|
||||
"ElementBot",
|
||||
]
|
||||
|
||||
if (!translationAllowList.includes(user)) {
|
||||
if (editedFiles.some(file => file.endsWith("strings.xml") && !file.endsWith("values/strings.xml"))) {
|
||||
fail("Some translation files have been edited. Only user `RiotTranslateBot` (i.e. translations coming from Weblate) or `github-actions[bot]` (i.e. translations coming from automation) are allowed to do that.\nPlease read more about translations management [in the doc](https://github.com/element-hq/element-android/blob/develop/CONTRIBUTING.md#internationalisation).")
|
||||
}
|
||||
|
||||
// Check that new strings are not added to `values/strings.xml`
|
||||
if (editedFiles.some(file => file.endsWith("ui-strings/src/main/res/values/strings.xml"))) {
|
||||
fail("`ui-strings/src/main/res/values/strings.xml` has been edited. This file will be overridden in the next strings synchronisation. Please add new strings in the file `values/strings_eax.xml` instead.")
|
||||
if (editedFiles.some(file => file.endsWith("translations.xml"))) {
|
||||
fail("Some translation files have been edited. Only user `ElementBot` (i.e. translations coming from Localazy) is allowed to do that.\nPlease read more about translations management [in the doc](https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#strings).")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user