Class: Octy::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/octy/core.rb

Instance Method Summary collapse

Constructor Details

#initializeCore

Returns a new instance of Core.



8
9
10
11
12
13
# File 'lib/octy/core.rb', line 8

def initialize
  options = {
    access_token: ENV['GITHUB_ACCESS_TOKEN']
  }
  @client = Octokit::Client.new(options)
end

Instance Method Details

#changelog(repo, from, to) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/octy/core.rb', line 15

def changelog(repo, from, to)
  comparison = @client.compare(repo, from, to)
  commits = comparison.commits.reverse
  commits.map do |commit|
    message = commit.commit.message
    if is_merge_pr?(message)
      pr_id = get_pr_id(message)
      pr = @client.pull_request(repo, pr_id)
      Printer.output(pr) if !pr.nil?
    end
  end
end