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 +5 -5
- data/.ruby-version +1 -1
- data/github_workflow.gemspec +1 -1
- data/lib/github_workflow/cli.rb +40 -0
- data/lib/github_workflow/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 28f643e846e22a863398a39b4a472d7b20933a83a9772b0ba3c02e6f049ac9c4
|
4
|
+
data.tar.gz: f15681e7469b55e793d4a6107f2140ea23af919e79bf3ff722d8ec76f603df26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6aeecd10787eea2aef5bd3ed545624e891416979c94d02c0007dcdf3f904ce8e9bec8022025aa9b214b74060b091a46380ce48a15be0753bc64115c82f324150
|
7
|
+
data.tar.gz: 6883523f9808705b7b6fb4e32a8fbf8984bbb08ceea1d655742a504c61729b0de8846eaaaf789524cd5a60859084082d998e49a6e2f91e4ae5a1ebd121d237aa
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3
|
1
|
+
2.5.3
|
data/github_workflow.gemspec
CHANGED
@@ -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"
|
24
|
+
spec.add_development_dependency "bundler"
|
25
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
26
|
end
|
data/lib/github_workflow/cli.rb
CHANGED
@@ -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 }
|
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.
|
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:
|
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: '
|
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: '
|
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.
|
120
|
+
rubygems_version: 2.7.6
|
121
121
|
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: DaisyBill's internal github workflows
|