kennel 1.91.3 → 1.92.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/kennel/github_reporter.rb +8 -5
- data/lib/kennel/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c49a8d3df01c51505bd27350f74dde6f4211fe576a97857e68f27f5d86aae4d
|
4
|
+
data.tar.gz: 72641a908961fe238b70a59d3e952abfccc83bd9522c12757f0d436993f73263
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1789814bea2d153d1428a751ce1b56dbdbd89714cc81608e4a133ae05377a55c724a26809419c995224f5f669387f5116926eb558646307a3415cb0672b10da5
|
7
|
+
data.tar.gz: 69ea27ba49933d745bf5cf362cb4361bee0bdf74cd4934fad6616b5ec9ba52216e4a5e365723550792c64a866d114b328c3c61483cce5b7b5ec0d2b21cdc476b
|
@@ -8,13 +8,15 @@ module Kennel
|
|
8
8
|
class << self
|
9
9
|
def report(token, &block)
|
10
10
|
return yield unless token
|
11
|
-
new(token
|
11
|
+
new(token).report(&block)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
def initialize(token,
|
15
|
+
def initialize(token, ref: "HEAD")
|
16
16
|
@token = token
|
17
|
-
|
17
|
+
commit = Utils.capture_sh("git show #{ref}")
|
18
|
+
@sha = commit[/^Merge: \S+ (\S+)/, 1] || commit[/\Acommit (\S+)/, 1] || raise("Unable to find commit")
|
19
|
+
@pr = commit[/^\s+.*\(#(\d+)\)/, 1] # from squash
|
18
20
|
@repo_part = ENV["GITHUB_REPOSITORY"] || begin
|
19
21
|
origin = ENV["PROJECT_REPOSITORY"] || Utils.capture_sh("git remote -v").split("\n").first
|
20
22
|
origin[%r{github\.com[:/](\S+?)(\.git|$)}, 1] || raise("no origin found in #{origin}")
|
@@ -37,13 +39,14 @@ module Kennel
|
|
37
39
|
body = body.byteslice(0, MAX_COMMENT_SIZE - TRUNCATED_MSG.bytesize) + TRUNCATED_MSG
|
38
40
|
end
|
39
41
|
|
40
|
-
|
42
|
+
path = (@pr ? "/repos/#{@repo_part}/issues/#{@pr}/comments" : "/repos/#{@repo_part}/commits/#{@sha}/comments")
|
43
|
+
post path, body: body
|
41
44
|
end
|
42
45
|
|
43
46
|
private
|
44
47
|
|
45
48
|
def post(path, data)
|
46
|
-
url = "https://api.github.com
|
49
|
+
url = "https://api.github.com#{path}"
|
47
50
|
response = Faraday.post(url, data.to_json, authorization: "token #{@token}")
|
48
51
|
raise "failed to POST to github:\n#{url} -> #{response.status}\n#{response.body}" unless response.status == 201
|
49
52
|
end
|
data/lib/kennel/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kennel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.92.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|