lib/octofacts_updater/service/github.rb
# Private: Find an existing pull request for the branch, and commit a new pull request if
# there was not an existing one open.
#
# Returns the pull request object that was created.
Find an existing pull request for the branch, and commit a new pull request if
there was not an existing one open.

Returns the pull request object that was created.
Find an existing pull request for the branch and commit a new pull request if there was not an existing one open . Returns the pull request object that was created .
def find_or_create_pull_request
        @find_or_create_pull_request ||= begin
          prs = octokit.pull_requests(repository, head: "github:#{branch}", state: "open")
          if prs && !prs.empty?
            verbose("Found existing PR #{prs.first.html_url}")
            prs.first
          else
            new_pr = octokit.create_pull_request(
              repository,
              default_branch,
              branch,
              pr_subject,
              pr_body
            )
            verbose("Created a new PR #{new_pr.html_url}")
            new_pr
          end
        end
      end
def find_or_create_pull_request @find_or_create_pull_request ||= begin prs = octokit . pull_requests ( repository , head : "github:#{branch}" , state : "open" ) if prs && ! prs . empty? verbose ( "Found existing PR #{prs.first.html_url}" ) prs . first else new_pr = octokit . create_pull_request ( repository , default_branch , branch , pr_subject , pr_body ) verbose ( "Created a new PR #{new_pr.html_url}" ) new_pr end end end
Private: Find an existing pull request for the branch, and commit a new pull request if
there was not an existing one open.
Private : Find an existing pull request for the branch and commit a new pull request if there was not an existing one open .