Allow user github-actions[bot] to update translations.

Check that new strings are not added to `values/strings.xml`
Signoff not required for "github-actions[bot]" user.
This commit is contained in:
Benoit Marty
2023-01-19 11:13:21 +01:00
committed by Benoit Marty
parent da3bc901a9
commit 19f2310191
2 changed files with 19 additions and 2 deletions

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Add new strings for Element X Android here -->
</resources>

View File

@@ -74,6 +74,7 @@ const allowList = [
"fedrunov",
"Florian14",
"ganfra",
"github-actions[bot]",
"jmartinesp",
"jonnyandrew",
"kittykat",
@@ -116,8 +117,18 @@ if (github.requested_reviewers.users.length == 0 && !pr.draft) {
}
// Check that translations have not been modified by developers
if (user != "RiotTranslateBot") {
const translationAllowList = [
"RiotTranslateBot",
"github-actions[bot]",
]
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) is allowed to do that.\nPlease read more about translations management [in the doc](https://github.com/vector-im/element-android/blob/develop/CONTRIBUTING.md#internationalisation).")
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/vector-im/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.")
}
}