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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3bfb3f26a7e3b72fcdda8f369f918a77fb6202da
4
- data.tar.gz: 6f39df4cb8e3e05e15f998ef432d2c7a3e7cb945
2
+ SHA256:
3
+ metadata.gz: 53ba0e2df80c00110a3c923f44d945fa0388216e1e8020134b1a16eb673cba83
4
+ data.tar.gz: 9062e3fa8a8082bc8d5f225c0ca64899b9d7894dc9a039dd8126f90351f97e95
5
5
  SHA512:
6
- metadata.gz: 9295e1bc074960518cfa5df144fcda58c0fbe4e26dc187bfe75f7fa5892c43d1cc2312043d09fb048e6ccb626d0cebb2e6b6d1d6dc79ff5cc054816735994bd4
7
- data.tar.gz: 83eae4748b845b27f7a54b89f079b3498908e252568692b23e4b1d3ecb3c02f1da5aa18095c85f894c12bc7fbbb1ed1562a9ca70766029fd5b5f73f2fcc25a03
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
@@ -0,0 +1,6 @@
1
+ status = [
2
+ "continuous-integration/travis-ci/push",
3
+ ]
4
+ # Uncomment this to use a two hour timeout.
5
+ # The default is one hour.
6
+ #timeout_sec = 7200
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
@@ -19,7 +19,7 @@ module Octocheck
19
19
 
20
20
  using_iterm2 = (
21
21
  ENV["TERM_PROGRAM"] == "iTerm.app" &&
22
- ENV.fetch("TERM_PROGRAM_VERSION", "").match(/3.[23456789].[123456789]/)
22
+ ENV.fetch("TERM_PROGRAM_VERSION", "").match(/3.[23456789]/)
23
23
  )
24
24
 
25
25
  formatter =
@@ -2,6 +2,7 @@ module Octocheck
2
2
  module Formatters
3
3
  module Color
4
4
  CODES = {
5
+ gray: 30,
5
6
  red: 31,
6
7
  green: 32,
7
8
  yellow: 33,
@@ -57,7 +57,30 @@ module Octocheck
57
57
  .map {|cr| cr.fetch(:github_url) }
58
58
  .join("\n")
59
59
 
60
- io.puts(["", state_summaries, link_summaries].join("\n"))
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
- io.puts(["", state_summaries, link_summaries].join("\n"))
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)
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Octocheck
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
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.2.1
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: 2019-04-17 00:00:00.000000000 Z
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
- rubyforge_project:
86
- rubygems_version: 2.5.2
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: []