github_workflow 0.3.4 → 0.3.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 +4 -4
- data/README.md +1 -0
- data/lib/github_workflow/cli.rb +20 -15
- data/lib/github_workflow/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: 7580dc54bf377d2f933a99075f5beceeea72dafa7e762a0f115d778d5cc7f9a1
|
4
|
+
data.tar.gz: f4904e4822f7d8cdc055055a9042ed7fbed11e7dbc1731fdc3b0a355a64f1b1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec90ff6d6108c21ddb5af9e380dd5b81140dbb1f648daf392594417f4553c534190ea33c9b3e4d0c5b5e5743fb5bf4e28e2367c9826d567f1b237e54c29c5558
|
7
|
+
data.tar.gz: d646ba0cbc3e72e5616968a23c53a2fc0714a74b1f8bdb143bb8aa9f636826b339ba304892b3faa206d3ace8be0e4c64487795349f77e0f1844587104bf8d728
|
data/README.md
CHANGED
@@ -12,4 +12,5 @@ Commands:
|
|
12
12
|
github_workflow push_and_pr # Push branch to origin and convert Issue to Pull Request
|
13
13
|
github_workflow start -i, --issue-id=ISSUE_ID # Create branch named with issue number and issue title
|
14
14
|
github_workflow status # Check PR CI status
|
15
|
+
github_workflow reviews # Print out reviewers list and their PRs count
|
15
16
|
```
|
data/lib/github_workflow/cli.rb
CHANGED
@@ -82,7 +82,7 @@ module GithubWorkflow
|
|
82
82
|
def status
|
83
83
|
ensure_github_config_present
|
84
84
|
ensure_origin_exists
|
85
|
-
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)
|
86
86
|
|
87
87
|
if response.empty?
|
88
88
|
alert "No statuses yet. Have you pushed your branch?"
|
@@ -111,7 +111,7 @@ module GithubWorkflow
|
|
111
111
|
desc "open", "Open issue or PR in browser"
|
112
112
|
def open
|
113
113
|
ensure_github_config_present
|
114
|
-
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)
|
115
115
|
`/usr/bin/open -a "/Applications/Google Chrome.app" '#{response["html_url"]}'`
|
116
116
|
end
|
117
117
|
|
@@ -171,15 +171,15 @@ module GithubWorkflow
|
|
171
171
|
|
172
172
|
no_tasks do
|
173
173
|
def get_issue(id)
|
174
|
-
JSON.parse(github_client.get("repos/#{user_and_repo}/issues/#{id}
|
174
|
+
JSON.parse(github_client.get("repos/#{user_and_repo}/issues/#{id}").body)
|
175
175
|
end
|
176
176
|
|
177
177
|
def get_pr(id)
|
178
|
-
JSON.parse(github_client.get("repos/#{user_and_repo}/pulls/#{id}
|
178
|
+
JSON.parse(github_client.get("repos/#{user_and_repo}/pulls/#{id}").body)
|
179
179
|
end
|
180
180
|
|
181
181
|
def get_prs_list
|
182
|
-
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)
|
183
183
|
end
|
184
184
|
|
185
185
|
def create_branch
|
@@ -204,9 +204,12 @@ module GithubWorkflow
|
|
204
204
|
labels: trello_card.labels.map(&:name)
|
205
205
|
}
|
206
206
|
|
207
|
-
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)
|
208
208
|
|
209
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"]
|
210
213
|
end
|
211
214
|
|
212
215
|
def issue_body_from_trello_card
|
@@ -238,7 +241,7 @@ module GithubWorkflow
|
|
238
241
|
end
|
239
242
|
|
240
243
|
def current_github_username
|
241
|
-
JSON.parse(github_client.get("user
|
244
|
+
JSON.parse(github_client.get("user").body)["login"]
|
242
245
|
end
|
243
246
|
|
244
247
|
def set_trello_card(type:)
|
@@ -251,7 +254,7 @@ module GithubWorkflow
|
|
251
254
|
Trello::Board.find(project_config["trello_board_id"])
|
252
255
|
end
|
253
256
|
|
254
|
-
@trello_card = trello_board.
|
257
|
+
@trello_card = trello_board.find_card(options["card_number"].to_i)
|
255
258
|
end
|
256
259
|
|
257
260
|
def trello_card
|
@@ -289,7 +292,7 @@ module GithubWorkflow
|
|
289
292
|
|
290
293
|
def create_issue
|
291
294
|
github_client.post(
|
292
|
-
"repos/#{user_and_repo}/issues
|
295
|
+
"repos/#{user_and_repo}/issues",
|
293
296
|
JSON.generate(
|
294
297
|
{
|
295
298
|
title: options[:name]
|
@@ -313,7 +316,7 @@ module GithubWorkflow
|
|
313
316
|
|
314
317
|
def convert_issue_to_pr
|
315
318
|
github_client.post(
|
316
|
-
"repos/#{user_and_repo}/pulls
|
319
|
+
"repos/#{user_and_repo}/pulls",
|
317
320
|
JSON.generate(
|
318
321
|
{
|
319
322
|
head: current_branch,
|
@@ -345,7 +348,7 @@ module GithubWorkflow
|
|
345
348
|
end
|
346
349
|
|
347
350
|
def branch_name_for_issue_number
|
348
|
-
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)
|
349
352
|
"#{issue['number']}_#{issue['title'].strip.downcase.gsub(/[^a-zA-Z0-9]/, '_').squeeze("_")}"
|
350
353
|
end
|
351
354
|
|
@@ -353,6 +356,7 @@ module GithubWorkflow
|
|
353
356
|
Faraday.new(url: "https://api.github.com") do |faraday|
|
354
357
|
faraday.request :url_encoded
|
355
358
|
faraday.adapter Faraday.default_adapter
|
359
|
+
faraday.authorization :Bearer, oauth_token
|
356
360
|
end
|
357
361
|
end
|
358
362
|
|
@@ -379,7 +383,8 @@ module GithubWorkflow
|
|
379
383
|
def stash_pop
|
380
384
|
if @stashed
|
381
385
|
say_info("Stash pop")
|
382
|
-
`git stash pop
|
386
|
+
`git stash pop`
|
387
|
+
nil
|
383
388
|
end
|
384
389
|
end
|
385
390
|
|
@@ -399,7 +404,7 @@ module GithubWorkflow
|
|
399
404
|
end
|
400
405
|
|
401
406
|
def commits_for_range
|
402
|
-
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)
|
403
408
|
end
|
404
409
|
|
405
410
|
def pull_request_in_commit_range
|
@@ -409,10 +414,10 @@ module GithubWorkflow
|
|
409
414
|
|
410
415
|
prs = pr_ids.map do |id|
|
411
416
|
say_info("Fetching Pull Request ##{id}")
|
412
|
-
pr = github_client.get("repos/#{user_and_repo}/pulls/#{id}
|
417
|
+
pr = github_client.get("repos/#{user_and_repo}/pulls/#{id}")
|
413
418
|
|
414
419
|
if pr.status == 404
|
415
|
-
JSON.parse(github_client.get("repos/#{user_and_repo}/issues/#{id}
|
420
|
+
JSON.parse(github_client.get("repos/#{user_and_repo}/issues/#{id}").body)
|
416
421
|
else
|
417
422
|
JSON.parse(pr.body)
|
418
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.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: 2021-
|
11
|
+
date: 2021-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|