Class: Danger::TracksChecker
- Inherits:
-
Plugin
- Object
- Plugin
- Danger::TracksChecker
- Defined in:
- lib/dangermattic/plugins/tracks_checker.rb
Overview
Plugin for checking tracks-related changes and providing instructions in the PR if that's the case.
Constant Summary collapse
- TRACKS_PR_INSTRUCTIONS =
<<~MESSAGE This PR contains changes to Tracks-related logic. Please ensure (**author and reviewer**) the following are completed: - The tracks events must be validated in the Tracks system. - Verify the internal Tracks spreadsheet has also been updated. - Please consider registering any new events. MESSAGE
- TRACKS_NO_LABEL_INSTRUCTION_FORMAT =
"- The PR must be assigned the **%s** label.\n"- TRACKS_NO_LABEL_MESSAGE_FORMAT =
'Please ensure the PR has the `%s` label.'
Instance Method Summary collapse
-
#check_tracks_changes(tracks_files:, tracks_usage_matchers:, tracks_label:) ⇒ void
Checks the PR diff for changes in Tracks-related files and provides instructions if changes are detected.
Instance Method Details
#check_tracks_changes(tracks_files:, tracks_usage_matchers:, tracks_label:) ⇒ void
This method returns an undefined value.
Checks the PR diff for changes in Tracks-related files and provides instructions if changes are detected
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/dangermattic/plugins/tracks_checker.rb', line 35 def check_tracks_changes(tracks_files:, tracks_usage_matchers:, tracks_label:) return unless changes_tracks_files?(tracks_files: tracks_files) || diff_has_tracks_changes?(tracks_usage_matchers: tracks_usage_matchers) = TRACKS_PR_INSTRUCTIONS unless tracks_label.nil? || tracks_label.empty? += format(TRACKS_NO_LABEL_INSTRUCTION_FORMAT, tracks_label) labels_checker.check( do_not_merge_labels: [], required_labels: [/#{Regexp.escape(tracks_label)}/], required_labels_error: format(TRACKS_NO_LABEL_MESSAGE_FORMAT, tracks_label) ) end # Tracks-related changes detected: publishing instructions () end |