circleci-bundle-update-pr 1.10.0 → 1.11.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 +4 -4
- data/Gemfile.lock +1 -1
- data/README-for-CircleCI-1.0.md +6 -2
- data/README.md +6 -2
- data/bin/circleci-bundle-update-pr +5 -1
- data/lib/circleci/bundle/update/pr.rb +24 -11
- data/lib/circleci/bundle/update/pr/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: 5742711f4f6b0cb19eec3d8f4573c3430866ea6a3158e3ff7675d20eba860b6b
|
4
|
+
data.tar.gz: 2c14e2e0ccea86e3164592e7555f82c23895ceb70bf784e3eebe3e50f6d057d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d20182cb0e5bc6a4e53dbd37059096d2c956e93a06995f5eb65609c1e424316414f88427d02c86676af23f7970b3eb3148641ca1bd29b50ba49f5b957f87e0a
|
7
|
+
data.tar.gz: 567daa514b62b47983f9d5877facfa9c5ce3a3d349b2af25671bd7f6c38ec09133840bd4dee63ebed5e7ba5eb6020b71984afed510a4ce447dab3545b79f1ed9
|
data/Gemfile.lock
CHANGED
data/README-for-CircleCI-1.0.md
CHANGED
@@ -102,10 +102,14 @@ By default, it works only on master branch, but you can also explicitly specify
|
|
102
102
|
$ circleci-bundle-update-pr <git username> <git email address> master develop topic
|
103
103
|
```
|
104
104
|
|
105
|
-
You can
|
105
|
+
You can also add the following options:
|
106
106
|
|
107
107
|
```
|
108
|
-
$ circleci-bundle-update-pr
|
108
|
+
$ circleci-bundle-update-pr -h
|
109
|
+
Usage: circleci-bundle-update-pr [options]
|
110
|
+
-a, --assignees alice,bob,carol Assign the PR to them
|
111
|
+
-r, --reviewers alice,bob,carol Request PR review to them
|
112
|
+
-l, --labels "In Review, Update" Add labels to the PR
|
109
113
|
```
|
110
114
|
|
111
115
|
## Contributing
|
data/README.md
CHANGED
@@ -109,10 +109,14 @@ By default, it works only on master branch, but you can also explicitly specify
|
|
109
109
|
$ circleci-bundle-update-pr <git username> <git email address> master develop topic
|
110
110
|
```
|
111
111
|
|
112
|
-
You can
|
112
|
+
You can also add the following options:
|
113
113
|
|
114
114
|
```
|
115
|
-
$ circleci-bundle-update-pr
|
115
|
+
$ circleci-bundle-update-pr -h
|
116
|
+
Usage: circleci-bundle-update-pr [options]
|
117
|
+
-a, --assignees alice,bob,carol Assign the PR to them
|
118
|
+
-r, --reviewers alice,bob,carol Request PR review to them
|
119
|
+
-l, --labels "In Review, Update" Add labels to the PR
|
116
120
|
```
|
117
121
|
|
118
122
|
## Contributing
|
@@ -5,7 +5,9 @@ require 'optparse'
|
|
5
5
|
|
6
6
|
opt = OptionParser.new
|
7
7
|
options = { assignees: [] }
|
8
|
-
opt.on('-a', '--assignees alice,bob,carol', Array, 'Assign the PR to them') { |v| options[:assignees] = v }
|
8
|
+
opt.on('-a', '--assignees alice,bob,carol', Array, 'Assign the PR to them') { |v| options[:assignees] = v.map(&:strip) }
|
9
|
+
opt.on('-r', '--reviewers alice,bob,carol', Array, 'Request PR review to them') { |v| options[:reviewers] = v.map(&:strip) }
|
10
|
+
opt.on('-l', '--labels "In Review, Update"', Array, 'Add labels to the PR') { |v| options[:labels] = v.map(&:strip) }
|
9
11
|
opt.parse!(ARGV)
|
10
12
|
|
11
13
|
Circleci::Bundle::Update::Pr.create_if_needed(
|
@@ -13,4 +15,6 @@ Circleci::Bundle::Update::Pr.create_if_needed(
|
|
13
15
|
git_email: ARGV.shift,
|
14
16
|
git_branches: ARGV.empty? ? ["master"] : ARGV,
|
15
17
|
assignees: options[:assignees],
|
18
|
+
reviewers: options[:reviewers],
|
19
|
+
labels: options[:labels],
|
16
20
|
)
|
@@ -6,7 +6,8 @@ module Circleci
|
|
6
6
|
module Bundle
|
7
7
|
module Update
|
8
8
|
module Pr
|
9
|
-
def self.create_if_needed(git_username: nil, git_email: nil, git_branches: ["master"],
|
9
|
+
def self.create_if_needed(git_username: nil, git_email: nil, git_branches: ["master"],
|
10
|
+
assignees: nil, reviewers: nil, labels: nil)
|
10
11
|
raise_if_env_unvalid!
|
11
12
|
return unless need?(git_branches)
|
12
13
|
repo_full_name = "#{ENV['CIRCLE_PROJECT_USERNAME']}/#{ENV['CIRCLE_PROJECT_REPONAME']}"
|
@@ -18,8 +19,10 @@ module Circleci
|
|
18
19
|
|
19
20
|
create_branch(git_username, git_email, branch, repo_full_name)
|
20
21
|
pull_request = create_pull_request(repo_full_name, branch, now)
|
21
|
-
|
22
|
-
add_assignees(repo_full_name, pull_request[:number], assignees)
|
22
|
+
update_pull_request_body(repo_full_name, pull_request[:number])
|
23
|
+
add_assignees(repo_full_name, pull_request[:number], assignees) if assignees
|
24
|
+
request_review(repo_full_name, pull_request[:number], reviewers) if reviewers
|
25
|
+
add_labels(repo_full_name, pull_request[:number], labels) if labels
|
23
26
|
end
|
24
27
|
|
25
28
|
def self.need?(git_branches)
|
@@ -46,32 +49,42 @@ module Circleci
|
|
46
49
|
def self.create_pull_request(repo_full_name, branch, now)
|
47
50
|
title = "bundle update at #{now.strftime('%Y-%m-%d %H:%M:%S %Z')}"
|
48
51
|
build_url = URI.parse ENV['CIRCLE_BUILD_URL']
|
49
|
-
|
50
|
-
client.create_pull_request(repo_full_name, ENV['CIRCLE_BRANCH'], branch, title, body)
|
52
|
+
client.create_pull_request(repo_full_name, ENV['CIRCLE_BRANCH'], branch, title)
|
51
53
|
end
|
52
54
|
private_class_method :create_pull_request
|
53
55
|
|
54
|
-
def self.
|
56
|
+
def self.update_pull_request_body(repo_full_name, pr_number)
|
55
57
|
ENV["OCTOKIT_ACCESS_TOKEN"] = ENV["GITHUB_ACCESS_TOKEN"]
|
56
58
|
compare_linker = CompareLinker.new(repo_full_name, pr_number)
|
57
59
|
compare_linker.formatter = CompareLinker::Formatter::Markdown.new
|
58
60
|
|
59
|
-
|
61
|
+
body = <<-EOB
|
60
62
|
**Updated RubyGems:**
|
61
63
|
|
62
64
|
#{compare_linker.make_compare_links.to_a.join("\n")}
|
63
65
|
|
64
|
-
Powered by [
|
65
|
-
|
66
|
-
|
66
|
+
Powered by [circleci-bundle-update-pr](https://rubygems.org/gems/circleci-bundle-update-pr)
|
67
|
+
EOB
|
68
|
+
|
69
|
+
client.update_pull_request(repo_full_name, pr_number, body: body)
|
67
70
|
end
|
68
|
-
private_class_method :
|
71
|
+
private_class_method :update_pull_request_body
|
69
72
|
|
70
73
|
def self.add_assignees(repo_full_name, pr_number, assignees)
|
71
74
|
client.add_assignees(repo_full_name, pr_number, assignees)
|
72
75
|
end
|
73
76
|
private_class_method :add_assignees
|
74
77
|
|
78
|
+
def self.request_review(repo_full_name, pr_number, reviewers)
|
79
|
+
client.request_pull_request_review(repo_full_name, pr_number, reviewers)
|
80
|
+
end
|
81
|
+
private_class_method :request_review
|
82
|
+
|
83
|
+
def self.add_labels(repo_full_name, pr_number, labels)
|
84
|
+
client.add_labels_to_an_issue(repo_full_name, pr_number, labels)
|
85
|
+
end
|
86
|
+
private_class_method :add_labels
|
87
|
+
|
75
88
|
def self.client
|
76
89
|
if enterprise?
|
77
90
|
Octokit::Client.new(access_token: ENV['ENTERPRISE_OCTOKIT_ACCESS_TOKEN'],
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: circleci-bundle-update-pr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Masuda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|