Class: MultiRepo::Helpers::UpdateBranchProtection
- Inherits:
-
Object
- Object
- MultiRepo::Helpers::UpdateBranchProtection
- Defined in:
- lib/multi_repo/helpers/update_branch_protection.rb
Instance Attribute Summary collapse
-
#branch ⇒ Object
readonly
Returns the value of attribute branch.
-
#dry_run ⇒ Object
readonly
Returns the value of attribute dry_run.
-
#github ⇒ Object
readonly
Returns the value of attribute github.
-
#repo_name ⇒ Object
readonly
Returns the value of attribute repo_name.
Instance Method Summary collapse
-
#initialize(repo_name, branch:, dry_run: false) ⇒ UpdateBranchProtection
constructor
A new instance of UpdateBranchProtection.
- #run ⇒ Object
Constructor Details
#initialize(repo_name, branch:, dry_run: false) ⇒ UpdateBranchProtection
Returns a new instance of UpdateBranchProtection.
5 6 7 8 9 |
# File 'lib/multi_repo/helpers/update_branch_protection.rb', line 5 def initialize(repo_name, branch:, dry_run: false, **) @repo_name = repo_name @branch = branch @github = MultiRepo::Service::Github.new(dry_run: dry_run) end |
Instance Attribute Details
#branch ⇒ Object (readonly)
Returns the value of attribute branch.
3 4 5 |
# File 'lib/multi_repo/helpers/update_branch_protection.rb', line 3 def branch @branch end |
#dry_run ⇒ Object (readonly)
Returns the value of attribute dry_run.
3 4 5 |
# File 'lib/multi_repo/helpers/update_branch_protection.rb', line 3 def dry_run @dry_run end |
#github ⇒ Object (readonly)
Returns the value of attribute github.
3 4 5 |
# File 'lib/multi_repo/helpers/update_branch_protection.rb', line 3 def github @github end |
#repo_name ⇒ Object (readonly)
Returns the value of attribute repo_name.
3 4 5 |
# File 'lib/multi_repo/helpers/update_branch_protection.rb', line 3 def repo_name @repo_name end |
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/multi_repo/helpers/update_branch_protection.rb', line 11 def run puts "Protecting #{branch} branch" settings = { :enforce_admins => nil, :required_status_checks => nil, :required_pull_request_reviews => nil, :restrictions => nil } github.protect_branch(repo_name, branch, settings) end |