]> git.openstreetmap.org Git - rails.git/commitdiff
Added new Danger labeling rule
authorNenad Vujicic <nenadus@gmail.com>
Mon, 4 Nov 2024 15:54:30 +0000 (16:54 +0100)
committerNenad Vujicic <nenadus@gmail.com>
Mon, 4 Nov 2024 17:47:26 +0000 (18:47 +0100)
Added new rule which checks if Gemfile is updated and Gemfile.lock is not updated and if positive generates "gemfile-lock-outdated" PR label.

Dangerfile

index 3148bafb693033d92037f0fd479a3356c92ede4b..6e2aeced8d487c36136181f82a4fd7fb2dccfa5d 100644 (file)
@@ -30,3 +30,13 @@ if git.commits.any? { |c| c.parents.count > 1 }
 else
   auto_label.remove("merge-commits")
 end
+
+# Check if Gemfile is modified but Gemfile.lock is not
+gemfile_modified = git.modified_files.include?("Gemfile")
+gemfile_lock_modified = git.modified_files.include?("Gemfile.lock")
+if gemfile_modified && !gemfile_lock_modified
+  warn("Gemfile was updated, but Gemfile.lock wasn't updated. Usually, when Gemfile is updated, you should run `bundle install` to update Gemfile.lock.")
+  auto_label.set(pr_number, "gemfile-lock-outdated", "F9D0C4")
+else
+  auto_label.remove("gemfile-lock-outdated")
+end