15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/octospy/parser/repository.rb', line 15
def parse_push_event
body = []
branch = @event.payload.ref.gsub('refs/heads/', '')
@event.payload.commits.each do |commit|
verbose_commit = Octokit.commit(@event.repo.name, commit.sha)
name = "#{verbose_commit.author ? verbose_commit.author.login : commit.author.name}"
link = "#{Octokit.web_endpoint}#{@event.repo.name}/commit/#{commit.sha}"
line = "#{name.to_s.colorize_for_irc.silver}: #{commit.message}"
line << " - #{link.shorten.to_s.colorize_for_irc.blue}"
body = body + "#{line}".split_lfbl
end
{
status: "pushed to #{branch}",
body: body,
link: "#{Octokit.web_endpoint}#{@event.repo.name}/tree/#{branch}",
notice_body: true
}
end
|