Class: Dependabot::PullRequestCreator::Github
- Inherits:
-
Object
- Object
- Dependabot::PullRequestCreator::Github
- Defined in:
- lib/dependabot/pull_request_creator/github.rb
Overview
rubocop:disable Metrics/ClassLength
Constant Summary collapse
- PR_DESCRIPTION_MAX_LENGTH =
GitHub limits PR descriptions to a max of 65,536 characters: github.com/orgs/community/discussions/27190#discussioncomment-3726017
65_535
Instance Attribute Summary collapse
-
#assignees ⇒ Object
readonly
0 based count.
-
#author_details ⇒ Object
readonly
0 based count.
-
#base_commit ⇒ Object
readonly
0 based count.
-
#branch_name ⇒ Object
readonly
0 based count.
-
#commit_message ⇒ Object
readonly
0 based count.
-
#credentials ⇒ Object
readonly
0 based count.
-
#custom_headers ⇒ Object
readonly
0 based count.
-
#files ⇒ Object
readonly
0 based count.
-
#labeler ⇒ Object
readonly
0 based count.
-
#milestone ⇒ Object
readonly
0 based count.
-
#pr_description ⇒ Object
readonly
0 based count.
-
#pr_name ⇒ Object
readonly
0 based count.
-
#reviewers ⇒ Object
readonly
0 based count.
-
#signature_key ⇒ Object
readonly
0 based count.
-
#source ⇒ Object
readonly
0 based count.
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(source:, branch_name:, base_commit:, credentials:, files:, commit_message:, pr_description:, pr_name:, author_details:, signature_key:, custom_headers:, labeler:, reviewers:, assignees:, milestone:, require_up_to_date_base:) ⇒ Github
constructor
A new instance of Github.
Constructor Details
#initialize(source:, branch_name:, base_commit:, credentials:, files:, commit_message:, pr_description:, pr_name:, author_details:, signature_key:, custom_headers:, labeler:, reviewers:, assignees:, milestone:, require_up_to_date_base:) ⇒ Github
Returns a new instance of Github.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/dependabot/pull_request_creator/github.rb', line 22 def initialize(source:, branch_name:, base_commit:, credentials:, files:, commit_message:, pr_description:, pr_name:, author_details:, signature_key:, custom_headers:, labeler:, reviewers:, assignees:, milestone:, require_up_to_date_base:) @source = source @branch_name = branch_name @base_commit = base_commit @credentials = credentials @files = files @commit_message = @pr_description = pr_description @pr_name = pr_name @author_details = @signature_key = signature_key @custom_headers = custom_headers @labeler = labeler @reviewers = reviewers @assignees = assignees @milestone = milestone @require_up_to_date_base = require_up_to_date_base end |
Instance Attribute Details
#assignees ⇒ Object (readonly)
0 based count
17 18 19 |
# File 'lib/dependabot/pull_request_creator/github.rb', line 17 def assignees @assignees end |
#author_details ⇒ Object (readonly)
0 based count
17 18 19 |
# File 'lib/dependabot/pull_request_creator/github.rb', line 17 def @author_details end |
#base_commit ⇒ Object (readonly)
0 based count
17 18 19 |
# File 'lib/dependabot/pull_request_creator/github.rb', line 17 def base_commit @base_commit end |
#branch_name ⇒ Object (readonly)
0 based count
17 18 19 |
# File 'lib/dependabot/pull_request_creator/github.rb', line 17 def branch_name @branch_name end |
#commit_message ⇒ Object (readonly)
0 based count
17 18 19 |
# File 'lib/dependabot/pull_request_creator/github.rb', line 17 def @commit_message end |
#credentials ⇒ Object (readonly)
0 based count
17 18 19 |
# File 'lib/dependabot/pull_request_creator/github.rb', line 17 def credentials @credentials end |
#custom_headers ⇒ Object (readonly)
0 based count
17 18 19 |
# File 'lib/dependabot/pull_request_creator/github.rb', line 17 def custom_headers @custom_headers end |
#files ⇒ Object (readonly)
0 based count
17 18 19 |
# File 'lib/dependabot/pull_request_creator/github.rb', line 17 def files @files end |
#labeler ⇒ Object (readonly)
0 based count
17 18 19 |
# File 'lib/dependabot/pull_request_creator/github.rb', line 17 def labeler @labeler end |
#milestone ⇒ Object (readonly)
0 based count
17 18 19 |
# File 'lib/dependabot/pull_request_creator/github.rb', line 17 def milestone @milestone end |
#pr_description ⇒ Object (readonly)
0 based count
17 18 19 |
# File 'lib/dependabot/pull_request_creator/github.rb', line 17 def pr_description @pr_description end |
#pr_name ⇒ Object (readonly)
0 based count
17 18 19 |
# File 'lib/dependabot/pull_request_creator/github.rb', line 17 def pr_name @pr_name end |
#reviewers ⇒ Object (readonly)
0 based count
17 18 19 |
# File 'lib/dependabot/pull_request_creator/github.rb', line 17 def reviewers @reviewers end |
#signature_key ⇒ Object (readonly)
0 based count
17 18 19 |
# File 'lib/dependabot/pull_request_creator/github.rb', line 17 def signature_key @signature_key end |
#source ⇒ Object (readonly)
0 based count
17 18 19 |
# File 'lib/dependabot/pull_request_creator/github.rb', line 17 def source @source end |
Instance Method Details
#create ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/dependabot/pull_request_creator/github.rb', line 45 def create if branch_exists?(branch_name) && unmerged_pull_request_exists? raise UnmergedPRExists, "PR ##{unmerged_pull_requests.first.number} already exists" end if require_up_to_date_base? && !base_commit_is_up_to_date? raise BaseCommitNotUpToDate, "HEAD #{head_commit} does not match base #{base_commit}" end create_annotated_pull_request rescue AnnotationError, Octokit::Error => e handle_error(e) end |