whatsup_github 0.2.0 → 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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/template/.whatsup.yml +2 -0
- data/lib/whatsup_github/config-reader.rb +5 -0
- data/lib/whatsup_github/pulls.rb +25 -5
- data/lib/whatsup_github/row.rb +9 -5
- data/lib/whatsup_github/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: 5608a3a48a7e700095336faec5d44de661229ec8d85d005f873ce0ed7fbfdf94
|
4
|
+
data.tar.gz: 9fe13981b406350104dd819918da01b8fbde05437da2893477c6c5d368154090
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b6832a0b57912c1daf4f80c6473b7851bcc97d4c2f3c30827291d59067b23dac9e27c1b94b013524f8ccad61539708a2ce3f3a5dbdea5cfd867015531763db3
|
7
|
+
data.tar.gz: ff8ab4e0434674332c19d1bbf8ff99ffe2259b480a0f566f62006a833359a4190818eca781a7b9494d02b62eb3ef472a4876da3600bcde936bf8b38d0812e148
|
data/Gemfile.lock
CHANGED
data/lib/template/.whatsup.yml
CHANGED
@@ -49,6 +49,10 @@ module WhatsupGithub
|
|
49
49
|
return [] unless res
|
50
50
|
res
|
51
51
|
end
|
52
|
+
|
53
|
+
def magic_word
|
54
|
+
read.dig 'magic_word'
|
55
|
+
end
|
52
56
|
end
|
53
57
|
end
|
54
58
|
|
@@ -60,4 +64,5 @@ if $PROGRAM_NAME == __FILE__
|
|
60
64
|
p config.labels
|
61
65
|
p config.required_labels
|
62
66
|
p config.optional_labels
|
67
|
+
p config.magic_word
|
63
68
|
end
|
data/lib/whatsup_github/pulls.rb
CHANGED
@@ -13,9 +13,12 @@ module WhatsupGithub
|
|
13
13
|
|
14
14
|
def filtered
|
15
15
|
issues = []
|
16
|
-
|
16
|
+
required_labels.each do |label|
|
17
17
|
issues += search_issues(label).items
|
18
18
|
end
|
19
|
+
optional_labels.each do |label|
|
20
|
+
issues += search_issues_with_magic_word(label).items
|
21
|
+
end
|
19
22
|
issues
|
20
23
|
end
|
21
24
|
|
@@ -29,8 +32,16 @@ module WhatsupGithub
|
|
29
32
|
Config.instance
|
30
33
|
end
|
31
34
|
|
32
|
-
def
|
33
|
-
configuration.
|
35
|
+
def optional_labels
|
36
|
+
configuration.optional_labels
|
37
|
+
end
|
38
|
+
|
39
|
+
def required_labels
|
40
|
+
configuration.required_labels
|
41
|
+
end
|
42
|
+
|
43
|
+
def magic_word
|
44
|
+
configuration.magic_word
|
34
45
|
end
|
35
46
|
|
36
47
|
def base_branch
|
@@ -43,7 +54,16 @@ module WhatsupGithub
|
|
43
54
|
|
44
55
|
def search_issues(label)
|
45
56
|
auto_paginate
|
46
|
-
|
57
|
+
query = "repo:#{repo} label:\"#{label}\" merged:>=#{since} base:#{base_branch}"
|
58
|
+
puts "Searching on GitHub by query #{query}"
|
59
|
+
client.search_issues(query)
|
60
|
+
end
|
61
|
+
|
62
|
+
def search_issues_with_magic_word(label)
|
63
|
+
auto_paginate
|
64
|
+
query = "repo:#{repo} label:\"#{label}\" merged:>=#{since} base:#{base_branch} \"#{magic_word}\" in:body"
|
65
|
+
puts "Searching on GitHub by query #{query}"
|
66
|
+
client.search_issues(query)
|
47
67
|
end
|
48
68
|
|
49
69
|
def auto_paginate
|
@@ -57,4 +77,4 @@ if $PROGRAM_NAME == __FILE__
|
|
57
77
|
two_weeks_ago = (Date.today - 14).to_s
|
58
78
|
pulls = WhatsupGithub::Pulls.new(repo: 'magento/devdocs', since: two_weeks_ago)
|
59
79
|
p pulls.filtered
|
60
|
-
end
|
80
|
+
end
|
data/lib/whatsup_github/row.rb
CHANGED
@@ -22,6 +22,10 @@ module WhatsupGithub
|
|
22
22
|
@config.required_labels
|
23
23
|
end
|
24
24
|
|
25
|
+
def magic_word
|
26
|
+
@config.magic_word
|
27
|
+
end
|
28
|
+
|
25
29
|
def versions
|
26
30
|
label_versions = labels.select { |label| label.start_with?(/\d\./) }
|
27
31
|
label_versions.join(', ')
|
@@ -36,8 +40,8 @@ module WhatsupGithub
|
|
36
40
|
end
|
37
41
|
|
38
42
|
def parse_body
|
39
|
-
|
40
|
-
newline_splited =
|
43
|
+
description_splited = body.split(magic_word)[-1]
|
44
|
+
newline_splited = description_splited.split("\n")
|
41
45
|
cleaned_array = newline_splited.map { |e| e.delete "\r\*" }
|
42
46
|
cleaned_array.delete('')
|
43
47
|
striped_array = cleaned_array.map(&:strip)
|
@@ -47,10 +51,10 @@ module WhatsupGithub
|
|
47
51
|
def description
|
48
52
|
# If a PR body includes a phrase 'whatsnew', then parse the body.
|
49
53
|
# If there are at least one required label but PR body does not include what's new, warn about missing 'whatsnew'
|
50
|
-
if body.include?(
|
54
|
+
if body.include?(magic_word)
|
51
55
|
parse_body
|
52
|
-
|
53
|
-
message = "MISSING
|
56
|
+
else
|
57
|
+
message = "MISSING #{magic_word} in the #{type} PR \##{pr_number}: \"#{title}\" assigned to #{assignee} (#{link})"
|
54
58
|
puts message
|
55
59
|
message
|
56
60
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whatsup_github
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dima Shevtsov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|