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("inappropriate-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, "inappropriate-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, see CONTRIBUTING.md.")
 
  29   auto_label.set(pr_number, "merge-commits", "D93F0B")
 
  31   auto_label.remove("merge-commits")
 
  34 # Check if Gemfile is modified but Gemfile.lock is not
 
  35 gemfile_modified = git.modified_files.include?("Gemfile")
 
  36 gemfile_lock_modified = git.modified_files.include?("Gemfile.lock")
 
  37 if gemfile_modified && !gemfile_lock_modified
 
  38   warn("Gemfile was updated, but Gemfile.lock wasn't updated. Usually, when Gemfile is updated, you should run `bundle install` to update Gemfile.lock.")
 
  39   auto_label.set(pr_number, "gemfile-lock-outdated", "F9D0C4")
 
  41   auto_label.remove("gemfile-lock-outdated")