Module: Integrations::PushDataValidations

Extended by:
ActiveSupport::Concern
Included in:
DroneCi, Teamcity
Defined in:
app/models/concerns/integrations/push_data_validations.rb

Instance Method Summary collapse

Instance Method Details

#merge_request_valid?(data) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'app/models/concerns/integrations/push_data_validations.rb', line 10

def merge_request_valid?(data)
  data.dig(:object_attributes, :state) == 'opened' && merge_request_unchecked?(data)
end

#push_valid?(data) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
18
19
# File 'app/models/concerns/integrations/push_data_validations.rb', line 14

def push_valid?(data)
  data[:total_commits_count] > 0 &&
    !branch_removed?(data) &&
    # prefer merge request trigger over push to avoid double builds
    !opened_merge_requests?(data)
end

#tag_push_valid?(data) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'app/models/concerns/integrations/push_data_validations.rb', line 21

def tag_push_valid?(data)
  data[:total_commits_count] > 0 && !branch_removed?(data)
end