class WhatsupGithub::Pulls
Gets issues found on GitHub by query
Attributes
repo[R]
since[R]
Public Class Methods
new(args = {})
click to toggle source
# File lib/whatsup_github/pulls.rb, line 12 def initialize(args = {}) @repo = args[:repo] @since = args[:since] end
Public Instance Methods
data()
click to toggle source
# File lib/whatsup_github/pulls.rb, line 17 def data pull_requests = [] filtered_numbers.each do |number| pull_requests << client.pull_request(@repo, number) end pull_requests end
Private Instance Methods
auto_paginate()
click to toggle source
# File lib/whatsup_github/pulls.rb, line 72 def auto_paginate Octokit.auto_paginate = true end
base_branch()
click to toggle source
# File lib/whatsup_github/pulls.rb, line 47 def base_branch configuration.base_branch end
client()
click to toggle source
Authorize with a GitHub token from $WHATSUP_GITHUB_ACCESS_TOKEN if available Otherwise, use credentials from ~/.netrc Otherwise, continue as a Guest
# File lib/whatsup_github/pulls.rb, line 54 def client Client.instance end
configuration()
click to toggle source
def access_token
credentials.dig 'github_token'
end
# File lib/whatsup_github/pulls.rb, line 31 def configuration Config.instance end
filtered_issues()
click to toggle source
# File lib/whatsup_github/pulls.rb, line 76 def filtered_issues issues = [] required_labels.each do |label| issues += search_issues(label).items end optional_labels.each do |label| issues += search_issues_with_magic_word(label).items end issues end
filtered_numbers()
click to toggle source
# File lib/whatsup_github/pulls.rb, line 87 def filtered_numbers filtered_issues.map(&:number) end
magic_word()
click to toggle source
# File lib/whatsup_github/pulls.rb, line 43 def magic_word configuration.magic_word end
optional_labels()
click to toggle source
# File lib/whatsup_github/pulls.rb, line 35 def optional_labels configuration.optional_labels end
required_labels()
click to toggle source
# File lib/whatsup_github/pulls.rb, line 39 def required_labels configuration.required_labels end
search_issues(label)
click to toggle source
# File lib/whatsup_github/pulls.rb, line 58 def search_issues(label) auto_paginate query = "repo:#{repo} label:\"#{label}\" merged:>=#{since} base:#{base_branch}" puts "Searching on GitHub by query #{query}" client.search_issues(query) end
search_issues_with_magic_word(label)
click to toggle source
# File lib/whatsup_github/pulls.rb, line 65 def search_issues_with_magic_word(label) auto_paginate query = "repo:#{repo} label:\"#{label}\" merged:>=#{since} base:#{base_branch} \"#{magic_word}\" in:body" puts "Searching on GitHub by query #{query}" client.search_issues(query) end