Skip to content

Commit

Permalink
Added new Danger labeling rule
Browse files Browse the repository at this point in the history
Added new rule which checks if Gemfile is updated and Gemfile.lock is not updated and if positive generates "gemfile-lock-outdated" PR label.
  • Loading branch information
nenad-vujicic committed Nov 4, 2024
1 parent 1b9b67f commit 216e249
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 216e249

Please sign in to comment.