github_workflow 0.1.7 → 0.1.8

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: 841c480ec29b5078ab1c744ff47f4a90a86294d9
4
- data.tar.gz: 65d669c742921894020f471129538bd906c15dd7
2
+ SHA256:
3
+ metadata.gz: 28f643e846e22a863398a39b4a472d7b20933a83a9772b0ba3c02e6f049ac9c4
4
+ data.tar.gz: f15681e7469b55e793d4a6107f2140ea23af919e79bf3ff722d8ec76f603df26
5
5
  SHA512:
6
- metadata.gz: 651f25d8f43973820c995c9c8f5d1242ffa2533d682d724d7fc714d91d899f1effcf17933b9ca9f1fb6f42a819cde933c634593a1e44c944abc1b4c6fc96a35f
7
- data.tar.gz: 5e76c09c4f3d29d3cc5138f264f4d2630230b9cec51199d60f46af041ca563e12cd2fe79bf30b9d41d22f21896801ac7f5c6b79ed3833a9a34435ad73622c659
6
+ metadata.gz: 6aeecd10787eea2aef5bd3ed545624e891416979c94d02c0007dcdf3f904ce8e9bec8022025aa9b214b74060b091a46380ce48a15be0753bc64115c82f324150
7
+ data.tar.gz: 6883523f9808705b7b6fb4e32a8fbf8984bbb08ceea1d655742a504c61729b0de8846eaaaf789524cd5a60859084082d998e49a6e2f91e4ae5a1ebd121d237aa
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.3.4
1
+ 2.5.3
@@ -21,6 +21,6 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency "faraday", "~> 0.11"
22
22
  spec.add_dependency "terminal-table", "~> 1.5"
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.14"
24
+ spec.add_development_dependency "bundler"
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
26
  end
@@ -109,6 +109,13 @@ module GithubWorkflow
109
109
  end
110
110
  end
111
111
 
112
+ desc "deploy_notes", "Generate Deploy notes for a range of commits"
113
+ method_option :commit_range, aliases: "-r", type: :string, required: true
114
+
115
+ def deploy_notes
116
+ puts formatted_deploy_notes
117
+ end
118
+
112
119
  no_tasks do
113
120
  def get_issue(id)
114
121
  JSON.parse(github_client.get("repos/#{user_and_repo}/issues/#{id}?access_token=#{oauth_token}").body)
@@ -273,6 +280,39 @@ module GithubWorkflow
273
280
  `git branch`.gsub(" ", "").split("\n").select { |br| br.match /^[0-9]/ }
274
281
  end
275
282
 
283
+ def commits_for_range
284
+ JSON.parse(github_client.get("repos/#{user_and_repo}/compare/#{options[:commit_range]}?access_token=#{oauth_token}").body)
285
+ end
286
+
287
+ def pull_request_in_commit_range
288
+ pr_ids = commits_for_range["commits"].map do |commit|
289
+ commit.dig("commit", "message").to_s.match(/(?<=\[#)\d{4,5}(?=\])/).to_s.to_i
290
+ end.uniq.compact
291
+
292
+ prs = pr_ids.map do |id|
293
+ say_info("Fetching Pull Request ##{id}")
294
+ pr = github_client.get("repos/#{user_and_repo}/pulls/#{id}?access_token=#{oauth_token}")
295
+
296
+ if pr.status == 404
297
+ JSON.parse(github_client.get("repos/#{user_and_repo}/issues/#{id}?access_token=#{oauth_token}").body)
298
+ else
299
+ JSON.parse(pr.body)
300
+ end
301
+ end
302
+ end
303
+
304
+ def formatted_deploy_notes
305
+ pull_request_in_commit_range.map do |pr|
306
+ deploy_note = pr["body"].to_s.match(/(?<=Deploy Note\:\*\*)(.*)(?=\r)/).to_s.strip
307
+
308
+ if deploy_note.length > 0
309
+ "- #{deploy_note}"
310
+ else
311
+ %Q{Missing deploy note: #{pr["title"]}}
312
+ end
313
+ end.unshift("[DaisyBill]")
314
+ end
315
+
276
316
  def success?(command)
277
317
  IO.popen(command) do |output|
278
318
  output.each { |line| puts line }
@@ -1,3 +1,3 @@
1
1
  module GithubWorkflow
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github_workflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Liscio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-27 00:00:00.000000000 Z
11
+ date: 2019-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '1.14'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '1.14'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  version: '0'
118
118
  requirements: []
119
119
  rubyforge_project:
120
- rubygems_version: 2.5.2
120
+ rubygems_version: 2.7.6
121
121
  signing_key:
122
122
  specification_version: 4
123
123
  summary: DaisyBill's internal github workflows