Add a rule to Danger to check that translation files are not modified by developers.

This commit is contained in:
Benoit Marty 2022-09-22 17:03:45 +02:00
parent f4c5cba020
commit cefe2e9ef4
2 changed files with 8 additions and 0 deletions

View file

@ -28,6 +28,7 @@ Here are the checks that Danger does so far:
- PR with change on layout should include screenshot in the description
- PR which adds png file warn about the usage of vector drawables
- non draft PR should have a reviewer
- files containing translations are not modified by developers
### Quality check

View file

@ -118,3 +118,10 @@ if (hasPngs) {
if (github.requested_reviewers.users.length == 0 && !pr.draft) {
warn("Please add a reviewer to your PR.")
}
// Check that translations have not been modified by developers
if (user != "RiotTranslateBot") {
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).")
}
}