octocheck 0.2.1 → 0.3.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 +5 -5
- data/README.md +7 -0
- data/bors.toml +6 -0
- data/lib/octocheck/api.rb +22 -0
- data/lib/octocheck/cli.rb +1 -1
- data/lib/octocheck/formatters/color.rb +1 -0
- data/lib/octocheck/formatters/iterm2.rb +24 -1
- data/lib/octocheck/formatters/simple.rb +26 -4
- data/lib/octocheck/summary.rb +8 -0
- data/lib/octocheck/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 53ba0e2df80c00110a3c923f44d945fa0388216e1e8020134b1a16eb673cba83
|
4
|
+
data.tar.gz: 9062e3fa8a8082bc8d5f225c0ca64899b9d7894dc9a039dd8126f90351f97e95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d29ec815332501e52ddef340da476943c2620ff9d384d5a624de8c0a80e384a67cdc5407f8f29351e8eb712a65494c4151db148de29295479a081a3c3c08a43c
|
7
|
+
data.tar.gz: d9f457ad664cd5e6af6dae036d195abc1039799d3a0a9127630911a347093658330af8b2d4e0dde86463da7f6799a1a3ef933de7569de156219dc11a4ca3b474
|
data/README.md
CHANGED
@@ -7,6 +7,13 @@ $ octocheck
|
|
7
7
|
success ci-check-1 https://example.com/ci-check-1
|
8
8
|
in_progress ci-check-2 https://example.com/ci-check-2
|
9
9
|
failed ci-check-3 https://example.com/ci-check-3
|
10
|
+
|
11
|
+
Branch:
|
12
|
+
https://github.com/org/repo/tree/branchname
|
13
|
+
|
14
|
+
PR:
|
15
|
+
https://github.com/org/repo/pull/174
|
16
|
+
|
10
17
|
```
|
11
18
|
|
12
19
|
### Installation
|
data/bors.toml
ADDED
data/lib/octocheck/api.rb
CHANGED
@@ -10,6 +10,14 @@ module Octocheck
|
|
10
10
|
@branch = branch
|
11
11
|
@repo = repo
|
12
12
|
@token = token
|
13
|
+
|
14
|
+
@pr_links = []
|
15
|
+
end
|
16
|
+
|
17
|
+
def branch_link
|
18
|
+
return unless branch
|
19
|
+
|
20
|
+
"https://github.com/#{org}/#{repo}/tree/#{branch}"
|
13
21
|
end
|
14
22
|
|
15
23
|
def statuses
|
@@ -28,6 +36,14 @@ module Octocheck
|
|
28
36
|
get("repos/#{org}/#{repo}/commits/#{branch}/check-runs")
|
29
37
|
.fetch("check_runs")
|
30
38
|
.map { |cr|
|
39
|
+
@pr_links += (
|
40
|
+
cr
|
41
|
+
.fetch("pull_requests", [])
|
42
|
+
.map { |pr| pr["number"] }
|
43
|
+
.compact
|
44
|
+
.map { |number| "https://github.com/#{org}/#{repo}/pull/#{number}" }
|
45
|
+
)
|
46
|
+
|
31
47
|
{
|
32
48
|
name: cr["name"],
|
33
49
|
state: cr["status"].downcase,
|
@@ -38,9 +54,15 @@ module Octocheck
|
|
38
54
|
}
|
39
55
|
end
|
40
56
|
|
57
|
+
def pr_links
|
58
|
+
@pr_links.uniq.sort
|
59
|
+
end
|
60
|
+
|
41
61
|
private
|
42
62
|
|
43
63
|
def check_run_details(text)
|
64
|
+
return [] unless text
|
65
|
+
|
44
66
|
text
|
45
67
|
.split("\n")
|
46
68
|
.map { |r|
|
data/lib/octocheck/cli.rb
CHANGED
@@ -57,7 +57,30 @@ module Octocheck
|
|
57
57
|
.map {|cr| cr.fetch(:github_url) }
|
58
58
|
.join("\n")
|
59
59
|
|
60
|
-
|
60
|
+
output = [
|
61
|
+
"",
|
62
|
+
state_summaries,
|
63
|
+
link_summaries,
|
64
|
+
]
|
65
|
+
|
66
|
+
if summary.branch_link
|
67
|
+
output += [
|
68
|
+
"",
|
69
|
+
"Branch:",
|
70
|
+
summary.branch_link
|
71
|
+
|
72
|
+
]
|
73
|
+
end
|
74
|
+
|
75
|
+
(summary.pr_links || []).each do |repo_link|
|
76
|
+
output += [
|
77
|
+
"",
|
78
|
+
"Pull Request:",
|
79
|
+
repo_link
|
80
|
+
]
|
81
|
+
end
|
82
|
+
|
83
|
+
io.puts(output.join("\n"))
|
61
84
|
end
|
62
85
|
|
63
86
|
def linkify(text, url)
|
@@ -22,7 +22,7 @@ module Octocheck
|
|
22
22
|
cols << [
|
23
23
|
colorize(status.fetch(:state)),
|
24
24
|
status.fetch(:name),
|
25
|
-
status.fetch(:target_url)
|
25
|
+
gray(status.fetch(:target_url))
|
26
26
|
].join(" ")
|
27
27
|
end
|
28
28
|
|
@@ -32,7 +32,7 @@ module Octocheck
|
|
32
32
|
cols << [
|
33
33
|
colorize(run.fetch(:state)),
|
34
34
|
run.fetch(:name),
|
35
|
-
run.fetch(:target_url)
|
35
|
+
gray(run.fetch(:target_url))
|
36
36
|
].join(" ")
|
37
37
|
|
38
38
|
run.fetch(:details).each do |detail|
|
@@ -41,7 +41,7 @@ module Octocheck
|
|
41
41
|
cols << [
|
42
42
|
colorize(detail.fetch(:state)),
|
43
43
|
detail.fetch(:name),
|
44
|
-
detail.fetch(:target_url)
|
44
|
+
gray(detail.fetch(:target_url))
|
45
45
|
].join(" ")
|
46
46
|
end
|
47
47
|
end
|
@@ -60,8 +60,30 @@ module Octocheck
|
|
60
60
|
.map {|cr| cr.fetch(:github_url) }
|
61
61
|
.join("\n")
|
62
62
|
|
63
|
-
|
63
|
+
output = [
|
64
|
+
"",
|
65
|
+
state_summaries,
|
66
|
+
link_summaries,
|
67
|
+
]
|
64
68
|
|
69
|
+
if summary.branch_link
|
70
|
+
output += [
|
71
|
+
"",
|
72
|
+
"Branch:",
|
73
|
+
summary.branch_link
|
74
|
+
|
75
|
+
]
|
76
|
+
end
|
77
|
+
|
78
|
+
(summary.pr_links || []).each do |repo_link|
|
79
|
+
output += [
|
80
|
+
"",
|
81
|
+
"Pull Request:",
|
82
|
+
repo_link
|
83
|
+
]
|
84
|
+
end
|
85
|
+
|
86
|
+
io.puts(output.join("\n"))
|
65
87
|
end
|
66
88
|
|
67
89
|
def colorize(text)
|
data/lib/octocheck/summary.rb
CHANGED
@@ -5,10 +5,18 @@ module Octocheck
|
|
5
5
|
@api = api
|
6
6
|
end
|
7
7
|
|
8
|
+
def branch_link
|
9
|
+
@branch_link ||= api.branch_link
|
10
|
+
end
|
11
|
+
|
8
12
|
def check_runs
|
9
13
|
@check_runs ||= api.check_runs
|
10
14
|
end
|
11
15
|
|
16
|
+
def pr_links
|
17
|
+
@pr_links ||= api.pr_links
|
18
|
+
end
|
19
|
+
|
12
20
|
def statuses
|
13
21
|
@statuses ||= api.statuses
|
14
22
|
end
|
data/lib/octocheck/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octocheck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Kinnecom
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
-
description:
|
41
|
+
description:
|
42
42
|
email:
|
43
43
|
- git@k7u7.com
|
44
44
|
executables:
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- Rakefile
|
54
54
|
- bin/console
|
55
55
|
- bin/setup
|
56
|
+
- bors.toml
|
56
57
|
- exe/octocheck
|
57
58
|
- lib/octocheck.rb
|
58
59
|
- lib/octocheck/api.rb
|
@@ -67,7 +68,7 @@ homepage: https://github.com/petekinnecom/octocheck
|
|
67
68
|
licenses: []
|
68
69
|
metadata:
|
69
70
|
allowed_push_host: https://rubygems.org
|
70
|
-
post_install_message:
|
71
|
+
post_install_message:
|
71
72
|
rdoc_options: []
|
72
73
|
require_paths:
|
73
74
|
- lib
|
@@ -82,9 +83,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
83
|
- !ruby/object:Gem::Version
|
83
84
|
version: '0'
|
84
85
|
requirements: []
|
85
|
-
|
86
|
-
|
87
|
-
signing_key:
|
86
|
+
rubygems_version: 3.3.3
|
87
|
+
signing_key:
|
88
88
|
specification_version: 4
|
89
89
|
summary: See github checks in your terminal
|
90
90
|
test_files: []
|