github_workflow 0.3.2 → 0.3.7
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/.ruby-version +1 -1
- data/lib/github_workflow/cli.rb +24 -32
- data/lib/github_workflow/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8271e322b33f74a9d09a2ddb73493a177954b367dfb2b4ead132dbe72874ffad
|
4
|
+
data.tar.gz: ba726efdd702aa7021637ef2d03f9975fbb7e9cbe21ccfe3b825c34fad7fd888
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e38c3753cab0d496d407c1fa2f9afcd32f8f78c823013ded75d9ca0dfb8418d02ac837dbabc7910c4d73be9a97aecdf60b8cfa5691c5624e863f5dbbe05a61f1
|
7
|
+
data.tar.gz: 3477e960a0b6b08ed0350ca2e7e498ea0262dc95c314ddc0834b87d18dec4c09b366249da6d887746dfba4e6253d7551489503f3ac93991d3f26a08077c4db74
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.7.
|
1
|
+
2.7.2
|
data/lib/github_workflow/cli.rb
CHANGED
@@ -34,7 +34,6 @@ module GithubWorkflow
|
|
34
34
|
set_trello_card(type: nil)
|
35
35
|
create_issue_from_trello_card
|
36
36
|
stash
|
37
|
-
checkout_main
|
38
37
|
rebase_main
|
39
38
|
create_branch
|
40
39
|
stash_pop
|
@@ -48,7 +47,6 @@ module GithubWorkflow
|
|
48
47
|
set_trello_card(type: :platform)
|
49
48
|
create_issue_from_trello_card
|
50
49
|
stash
|
51
|
-
checkout_main
|
52
50
|
rebase_main
|
53
51
|
create_branch
|
54
52
|
stash_pop
|
@@ -59,7 +57,6 @@ module GithubWorkflow
|
|
59
57
|
def start
|
60
58
|
ensure_github_config_present
|
61
59
|
stash
|
62
|
-
checkout_main
|
63
60
|
rebase_main
|
64
61
|
create_branch
|
65
62
|
stash_pop
|
@@ -85,7 +82,7 @@ module GithubWorkflow
|
|
85
82
|
def status
|
86
83
|
ensure_github_config_present
|
87
84
|
ensure_origin_exists
|
88
|
-
response = JSON.parse(github_client.get("repos/#{user_and_repo}/statuses/#{current_branch}
|
85
|
+
response = JSON.parse(github_client.get("repos/#{user_and_repo}/statuses/#{current_branch}").body)
|
89
86
|
|
90
87
|
if response.empty?
|
91
88
|
alert "No statuses yet. Have you pushed your branch?"
|
@@ -114,7 +111,7 @@ module GithubWorkflow
|
|
114
111
|
desc "open", "Open issue or PR in browser"
|
115
112
|
def open
|
116
113
|
ensure_github_config_present
|
117
|
-
response = JSON.parse(github_client.get("repos/#{user_and_repo}/issues/#{issue_number_from_branch}
|
114
|
+
response = JSON.parse(github_client.get("repos/#{user_and_repo}/issues/#{issue_number_from_branch}").body)
|
118
115
|
`/usr/bin/open -a "/Applications/Google Chrome.app" '#{response["html_url"]}'`
|
119
116
|
end
|
120
117
|
|
@@ -174,19 +171,19 @@ module GithubWorkflow
|
|
174
171
|
|
175
172
|
no_tasks do
|
176
173
|
def get_issue(id)
|
177
|
-
JSON.parse(github_client.get("repos/#{user_and_repo}/issues/#{id}
|
174
|
+
JSON.parse(github_client.get("repos/#{user_and_repo}/issues/#{id}").body)
|
178
175
|
end
|
179
176
|
|
180
177
|
def get_pr(id)
|
181
|
-
JSON.parse(github_client.get("repos/#{user_and_repo}/pulls/#{id}
|
178
|
+
JSON.parse(github_client.get("repos/#{user_and_repo}/pulls/#{id}").body)
|
182
179
|
end
|
183
180
|
|
184
181
|
def get_prs_list
|
185
|
-
JSON.parse(github_client.get("repos/#{user_and_repo}/pulls
|
182
|
+
JSON.parse(github_client.get("repos/#{user_and_repo}/pulls&per_page=100").body)
|
186
183
|
end
|
187
184
|
|
188
185
|
def create_branch
|
189
|
-
`git checkout -b #{branch_name_for_issue_number}`
|
186
|
+
`git checkout -b #{branch_name_for_issue_number} main`
|
190
187
|
end
|
191
188
|
|
192
189
|
def ensure_origin_exists
|
@@ -207,9 +204,12 @@ module GithubWorkflow
|
|
207
204
|
labels: trello_card.labels.map(&:name)
|
208
205
|
}
|
209
206
|
|
210
|
-
response = JSON.parse(github_client.post("repos/#{user_and_repo}/issues
|
207
|
+
response = JSON.parse(github_client.post("repos/#{user_and_repo}/issues", issue_params.to_json).body)
|
211
208
|
|
212
209
|
@issue_id = response["number"]
|
210
|
+
|
211
|
+
github_client.post("/repos/#{user_and_repo}/issues/#{@issue_id}/comments", { body: trello_card.short_url }.to_json)
|
212
|
+
trello_card.add_attachment response["html_url"]
|
213
213
|
end
|
214
214
|
|
215
215
|
def issue_body_from_trello_card
|
@@ -241,7 +241,7 @@ module GithubWorkflow
|
|
241
241
|
end
|
242
242
|
|
243
243
|
def current_github_username
|
244
|
-
JSON.parse(github_client.get("user
|
244
|
+
JSON.parse(github_client.get("user").body)["login"]
|
245
245
|
end
|
246
246
|
|
247
247
|
def set_trello_card(type:)
|
@@ -254,7 +254,7 @@ module GithubWorkflow
|
|
254
254
|
Trello::Board.find(project_config["trello_board_id"])
|
255
255
|
end
|
256
256
|
|
257
|
-
@trello_card = trello_board.
|
257
|
+
@trello_card = trello_board.find_card(options["card_number"].to_i)
|
258
258
|
end
|
259
259
|
|
260
260
|
def trello_card
|
@@ -263,7 +263,7 @@ module GithubWorkflow
|
|
263
263
|
|
264
264
|
def ensure_github_config_present
|
265
265
|
if project_config.nil? || (JSON.parse(GITHUB_CONFIG).keys - project_config.keys).any?
|
266
|
-
failure("Please add `.
|
266
|
+
failure("Please add `.github_workflow` file containing:\n#{GITHUB_CONFIG}")
|
267
267
|
end
|
268
268
|
end
|
269
269
|
|
@@ -275,7 +275,7 @@ module GithubWorkflow
|
|
275
275
|
end
|
276
276
|
|
277
277
|
def project_config
|
278
|
-
@project_config ||= JSON.parse(File.read(".
|
278
|
+
@project_config ||= JSON.parse(File.read(".github_workflow")) rescue nil
|
279
279
|
end
|
280
280
|
|
281
281
|
def oauth_token
|
@@ -292,7 +292,7 @@ module GithubWorkflow
|
|
292
292
|
|
293
293
|
def create_issue
|
294
294
|
github_client.post(
|
295
|
-
"repos/#{user_and_repo}/issues
|
295
|
+
"repos/#{user_and_repo}/issues",
|
296
296
|
JSON.generate(
|
297
297
|
{
|
298
298
|
title: options[:name]
|
@@ -316,7 +316,7 @@ module GithubWorkflow
|
|
316
316
|
|
317
317
|
def convert_issue_to_pr
|
318
318
|
github_client.post(
|
319
|
-
"repos/#{user_and_repo}/pulls
|
319
|
+
"repos/#{user_and_repo}/pulls",
|
320
320
|
JSON.generate(
|
321
321
|
{
|
322
322
|
head: current_branch,
|
@@ -348,7 +348,7 @@ module GithubWorkflow
|
|
348
348
|
end
|
349
349
|
|
350
350
|
def branch_name_for_issue_number
|
351
|
-
issue = JSON.parse(github_client.get("repos/#{user_and_repo}/issues/#{issue_id}
|
351
|
+
issue = JSON.parse(github_client.get("repos/#{user_and_repo}/issues/#{issue_id}").body)
|
352
352
|
"#{issue['number']}_#{issue['title'].strip.downcase.gsub(/[^a-zA-Z0-9]/, '_').squeeze("_")}"
|
353
353
|
end
|
354
354
|
|
@@ -356,29 +356,20 @@ module GithubWorkflow
|
|
356
356
|
Faraday.new(url: "https://api.github.com") do |faraday|
|
357
357
|
faraday.request :url_encoded
|
358
358
|
faraday.adapter Faraday.default_adapter
|
359
|
+
faraday.authorization :Bearer, oauth_token
|
359
360
|
end
|
360
361
|
end
|
361
362
|
|
362
363
|
def rebase_main
|
363
364
|
say_info("Fetching changes and rebasing main")
|
364
365
|
|
365
|
-
if success?("git pull --rebase")
|
366
|
+
if success?("git pull origin main:main --rebase")
|
366
367
|
pass("Fetched and rebased")
|
367
368
|
else
|
368
369
|
failure("Failed to fetch or rebase")
|
369
370
|
end
|
370
371
|
end
|
371
372
|
|
372
|
-
def checkout_main
|
373
|
-
say_info("Checking out main")
|
374
|
-
|
375
|
-
if success?("git checkout main")
|
376
|
-
pass("Checked out main")
|
377
|
-
else
|
378
|
-
failure("Failed to checkout main")
|
379
|
-
end
|
380
|
-
end
|
381
|
-
|
382
373
|
def stash
|
383
374
|
`git diff --quiet`
|
384
375
|
|
@@ -392,7 +383,8 @@ module GithubWorkflow
|
|
392
383
|
def stash_pop
|
393
384
|
if @stashed
|
394
385
|
say_info("Stash pop")
|
395
|
-
`git stash pop
|
386
|
+
`git stash pop`
|
387
|
+
nil
|
396
388
|
end
|
397
389
|
end
|
398
390
|
|
@@ -412,7 +404,7 @@ module GithubWorkflow
|
|
412
404
|
end
|
413
405
|
|
414
406
|
def commits_for_range
|
415
|
-
JSON.parse(github_client.get("repos/#{user_and_repo}/compare/#{options[:commit_range]}
|
407
|
+
JSON.parse(github_client.get("repos/#{user_and_repo}/compare/#{options[:commit_range]}").body)
|
416
408
|
end
|
417
409
|
|
418
410
|
def pull_request_in_commit_range
|
@@ -422,10 +414,10 @@ module GithubWorkflow
|
|
422
414
|
|
423
415
|
prs = pr_ids.map do |id|
|
424
416
|
say_info("Fetching Pull Request ##{id}")
|
425
|
-
pr = github_client.get("repos/#{user_and_repo}/pulls/#{id}
|
417
|
+
pr = github_client.get("repos/#{user_and_repo}/pulls/#{id}")
|
426
418
|
|
427
419
|
if pr.status == 404
|
428
|
-
JSON.parse(github_client.get("repos/#{user_and_repo}/issues/#{id}
|
420
|
+
JSON.parse(github_client.get("repos/#{user_and_repo}/issues/#{id}").body)
|
429
421
|
else
|
430
422
|
JSON.parse(pr.body)
|
431
423
|
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.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Liscio
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -114,7 +114,7 @@ dependencies:
|
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '10.0'
|
117
|
-
description:
|
117
|
+
description:
|
118
118
|
email:
|
119
119
|
- bliscio@daisybill.com
|
120
120
|
executables:
|
@@ -135,7 +135,7 @@ homepage: https://github.com/daisybill/github_workflow
|
|
135
135
|
licenses:
|
136
136
|
- MIT
|
137
137
|
metadata: {}
|
138
|
-
post_install_message:
|
138
|
+
post_install_message:
|
139
139
|
rdoc_options: []
|
140
140
|
require_paths:
|
141
141
|
- lib
|
@@ -150,8 +150,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
150
|
- !ruby/object:Gem::Version
|
151
151
|
version: '0'
|
152
152
|
requirements: []
|
153
|
-
rubygems_version: 3.1.
|
154
|
-
signing_key:
|
153
|
+
rubygems_version: 3.1.4
|
154
|
+
signing_key:
|
155
155
|
specification_version: 4
|
156
156
|
summary: DaisyBill's internal github workflows
|
157
157
|
test_files: []
|