Class: RooOnRails::Checks::GitHub::BranchProtection

Inherits:
Base
  • Object
show all
Defined in:
lib/roo_on_rails/checks/github/branch_protection.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, requires, #run

Methods included from Helpers

#bold, included

Constructor Details

This class inherits a constructor from RooOnRails::Checks::Base

Instance Method Details

#callObject



15
16
17
18
19
20
# File 'lib/roo_on_rails/checks/github/branch_protection.rb', line 15

def call
  ensure_status_checks!
  ensure_code_reviews!
  ensure_no_push!
  pass 'branch protection is sufficient'
end

#fixObject



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/roo_on_rails/checks/github/branch_protection.rb', line 22

def fix
  client.protect_branch(
    repo,
    branch,
    options.merge(
      required_status_checks: fixed_required_status_checks,
      required_pull_request_reviews: fixed_pull_request_reviews,
      restrictions: fixed_restrictions,
      enforce_admins: true
    )
  )
end

#introObject



11
12
13
# File 'lib/roo_on_rails/checks/github/branch_protection.rb', line 11

def intro
  'Checking if GitHub master branch is protected...'
end