Class: Pronto::Github
Instance Method Summary
collapse
Methods inherited from Client
#env_pull_id, #initialize
Constructor Details
This class inherits a constructor from Pronto::Client
Instance Method Details
16
17
18
19
20
21
22
|
# File 'lib/pronto/github.rb', line 16
def (sha)
@comment_cache[sha.to_s] ||= begin
client.(slug, sha).map do ||
Comment.new(sha, .body, .path, .position)
end
end
end
|
24
25
26
27
28
|
# File 'lib/pronto/github.rb', line 24
def ()
@config.logger.log("Creating commit comment on #{.sha}")
client.(slug, .sha, .body,
.path, nil, .position)
end
|
#create_commit_status(status) ⇒ Object
51
52
53
54
55
56
57
|
# File 'lib/pronto/github.rb', line 51
def create_commit_status(status)
sha = pull_sha || status.sha
@config.logger.log("Creating comment status on #{sha}")
client.create_status(slug, sha, status.state,
context: status.context,
description: status.description)
end
|
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/pronto/github.rb', line 30
def ()
if .path && .position
@config.logger.log("Creating pull request comment on #{pull_id}")
client.(slug, pull_id, .body,
pull_sha || .sha,
.path, .position)
else
()
end
end
|
#create_pull_request_review(comments) ⇒ Object
41
42
43
44
45
46
47
48
49
|
# File 'lib/pronto/github.rb', line 41
def create_pull_request_review()
options = {
event: 'COMMENT',
comments: .map do |c|
{ path: c.path, position: c.position, body: c.body }
end
}
client.create_pull_request_review(slug, pull_id, options)
end
|
3
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/pronto/github.rb', line 3
def (sha)
@comment_cache["#{pull_id}/#{sha}"] ||= begin
client.(slug, pull_id).map do ||
Comment.new(sha, .body, .path,
.position || .original_position)
end
end
rescue Octokit::NotFound => e
@config.logger.log("Error raised and rescued: #{e}")
msg = "Pull request for sha #{sha} with id #{pull_id} was not found."
raise Pronto::Error, msg
end
|