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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c5a5193535cbcad7a2e79333943ca9761e7b6bc06a867fffacaf3abac90ce47
4
- data.tar.gz: e0f92a5c0619da8911035a61b3cb0e17dab44344b99db02986da0fbb67cf4c76
3
+ metadata.gz: 5608a3a48a7e700095336faec5d44de661229ec8d85d005f873ce0ed7fbfdf94
4
+ data.tar.gz: 9fe13981b406350104dd819918da01b8fbde05437da2893477c6c5d368154090
5
5
  SHA512:
6
- metadata.gz: 43c4beaa0b90f93aeb01ab7a2f2643702ac8d078bd3b21801a250a7918dba077ecee5f9138d731e3817ad78719769bc4167f32ce7bdfad480c374e790a498251
7
- data.tar.gz: 9247198a00d96c500236f093dc7b458e256220b8763ab6831207c014f1da6acd5d24aa95f3fc47b45cf5850e727543e8d53515a0684432b07f0d58d96fb9dff5
6
+ metadata.gz: 9b6832a0b57912c1daf4f80c6473b7851bcc97d4c2f3c30827291d59067b23dac9e27c1b94b013524f8ccad61539708a2ce3f3a5dbdea5cfd867015531763db3
7
+ data.tar.gz: ff8ab4e0434674332c19d1bbf8ff99ffe2259b480a0f566f62006a833359a4190818eca781a7b9494d02b62eb3ef472a4876da3600bcde936bf8b38d0812e148
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- whatsup_github (0.2.0)
4
+ whatsup_github (0.3.0)
5
5
  netrc (~> 0.10)
6
6
  octokit (~> 4.14)
7
7
  thor (~> 0.20)
@@ -16,3 +16,5 @@ labels:
16
16
  output_format:
17
17
  - yaml
18
18
  # - markdown
19
+
20
+ magic_word: whatsnew
@@ -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
@@ -13,9 +13,12 @@ module WhatsupGithub
13
13
 
14
14
  def filtered
15
15
  issues = []
16
- labels.each do |label|
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 labels
33
- configuration.labels
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
- client.search_issues("repo:#{repo} label:\"#{label}\" merged:>=#{since} base:#{base_branch}")
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
@@ -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
- whatsnew_splited = body.split('whatsnew')[-1]
40
- newline_splited = whatsnew_splited.split("\n")
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?('whatsnew')
54
+ if body.include?(magic_word)
51
55
  parse_body
52
- elsif !(labels & required_labels).empty? && !body.include?('whatsnew')
53
- message = "MISSING whatsnew in the #{type} PR \##{pr_number}: \"#{title}\" assigned to #{assignee} (#{link})"
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
@@ -1,3 +1,3 @@
1
1
  module WhatsupGithub
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  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.2.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-25 00:00:00.000000000 Z
11
+ date: 2020-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit