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 +4 -4
- data/lib/github_bot/github/check_run.rb +5 -0
- data/lib/github_bot/github/payload.rb +5 -0
- data/lib/github_bot/validator/base.rb +25 -8
- data/lib/github_bot/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: 2f91b35d6fe28c32deee9770c57314be29c9a009472950b46e762eb5c8cc6a61
|
4
|
+
data.tar.gz: 37158afb12b6a04053e47e895098f6b51c95c4278d381d9d7ce2a6eb82ef51d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
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
|
data/lib/github_bot/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2021-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|