2 pr_number = github.pr_json["number"]
4 # Report if number of changed lines is > 500
5 if git.lines_of_code > 500
6 warn("Number of updated lines of code is too large to be in one PR. Perhaps it should be separated into two or more?")
7 auto_label.set(pr_number, "Big PR", "FBCA04")
9 auto_label.remove("Big PR")
12 # Get list of translation files (except en.yml) which are modified
13 modified_yml_files = git.modified_files.select do |file|
14 file.start_with?("config/locales") && File.extname(file) == ".yml" && File.basename(file) != "en.yml"
17 # Report if some translation file (except en.yml) is modified
18 if modified_yml_files.empty?
19 auto_label.remove("Compromised Translations")
21 modified_files_str = modified_yml_files.map { |file| "`#{file}`" }.join(", ")
22 warn("The following YAML files other than `en.yml` have been modified: #{modified_files_str}. Only `en.yml` is allowed to be changed. Translations are updated via Translatewiki, see CONTRIBUTING.md.")
23 auto_label.set(pr_number, "Compromised Translations", "B60205")
26 # Report if there are merge-commits in PR
27 if git.commits.any? { |c| c.parents.count > 1 }
28 warn("Merge commits are found in PR. Please rebase to get rid of the merge commits in this PR and read CONTRIBUTE.md.")
29 auto_label.set(pr_number, "Merge Commits", "D93F0B")
31 auto_label.remove("Merge Commits")