github_bot 0.1.1 → 0.2.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
2
  SHA256:
3
- metadata.gz: 55e5c2085a789f760946a31c8045af4bd6cfbfbddd86a27b6a733d409f20f37e
4
- data.tar.gz: 91de233efa71c6cd583d9d3a41496e6b01ffd9428aa73afdc0243a9430fa867c
3
+ metadata.gz: 2f91b35d6fe28c32deee9770c57314be29c9a009472950b46e762eb5c8cc6a61
4
+ data.tar.gz: 37158afb12b6a04053e47e895098f6b51c95c4278d381d9d7ce2a6eb82ef51d3
5
5
  SHA512:
6
- metadata.gz: 06f5dc19cb2f0516277c46ecffce1031f1ac7d5e5e60a2302ed5cc58260926523418ba467c4b147469debf8310d64163f8ea1577a4e71fe5c0762f212f1ef9d6
7
- data.tar.gz: 1466c3f469110542d78538254e0c489fb256020e0f1a3cea8dc3530a113426a28516dcdaf0031b8ec21718d7217c23d9d15cb177c43438a6e3ffbc693ad44961
6
+ metadata.gz: ae7fcf35e172a983abd64f4d02cacc55860403fc01a263de41d531cb686018508f0c5c5453f97bc93111a736d263daa39bbc2e548bbc408eefba5f33053e7e54
7
+ data.tar.gz: e1923407e45123b695147b01a8088fc681eaf476428bc38203a7ff990ecdd9c89b0702fafaf6f68412f046132710347705e27d57e1c1cdae0a089eace17a060d
@@ -44,6 +44,11 @@ module GithubBot
44
44
  update(status: 'completed', conclusion: 'action_required', completed_at: Time.now, **options)
45
45
  end
46
46
 
47
+ # Public: Updates the check run to a neutral state
48
+ def neutral!(**options)
49
+ update(status: 'completed', conclusion: 'neutral', completed_at: Time.now, **options)
50
+ end
51
+
47
52
  private
48
53
 
49
54
  def update(**options)
@@ -67,6 +67,11 @@ module GithubBot
67
67
  end
68
68
  end
69
69
 
70
+ # Public: Returns the review information for payloads that are of type pull request review
71
+ def review
72
+ payload[:review]
73
+ end
74
+
70
75
  # Public: Returns <true> if the sender is of type 'Bot'; otherwise, <false>
71
76
  def sender_type_bot?
72
77
  payload[:sender][:type].downcase == 'bot' # rubocop:disable Performance/Casecmp
@@ -69,14 +69,31 @@ module GithubBot
69
69
  else
70
70
  # because limitation of 50 checks per API call execution, break up annotations
71
71
  # https://developer.github.com/v3/checks/runs/
72
- @feedback.each_slice(50).to_a.each do |annotations|
73
- @check.action_required!(
74
- output: {
75
- title: "#{name} validation is complete...",
76
- summary: "#{name} validation determined there are changes that need attention.",
77
- annotations: annotations
78
- }
79
- )
72
+
73
+ # need to identify if something other than warnings
74
+ non_warnings = @feedback.select { |h| h[:annotation_level] != 'warning' }
75
+
76
+ if non_warnings.empty?
77
+ @feedback.each_slice(50).to_a.each do |annotations|
78
+ @check.neutral!(
79
+ output: {
80
+ title: "#{name} validation is complete...",
81
+ summary: "#{name} validation determined there are no required changes; however, please review the " \
82
+ 'warnings as they may impact future changes.',
83
+ annotations: annotations
84
+ }
85
+ )
86
+ end
87
+ else
88
+ @feedback.each_slice(50).to_a.each do |annotations|
89
+ @check.action_required!(
90
+ output: {
91
+ title: "#{name} validation is complete...",
92
+ summary: "#{name} validation determined there are changes that need attention.",
93
+ annotations: annotations
94
+ }
95
+ )
96
+ end
80
97
  end
81
98
  end
82
99
  rescue StandardError => e
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GithubBot
4
- VERSION = '0.1.1'
4
+ VERSION = '0.2.0'
5
5
 
6
6
  # version module
7
7
  module Version
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Howdeshell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-31 00:00:00.000000000 Z
11
+ date: 2021-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git