git-pr-release 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/README.md +1 -13
- data/git-pr-release.gemspec +1 -1
- data/lib/git/pr/release/cli.rb +14 -3
- data/lib/git/pr/release/pull_request.rb +8 -0
- data/spec/git/pr/release/cli_spec.rb +27 -0
- data/spec/spec_helper.rb +3 -0
- 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: 8a0c2d1ded6d8e250d8cafcce83e7148ebaf274a1afb92ce5b4b5469a29e3cec
|
4
|
+
data.tar.gz: 26eb1888e585695c2f2cdd0154b59d61ff80c2781c423b175227e7156aadd9d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e25446387c28b266051d6e1d40b6dd8b553ba5d84f174bf32804c70f96e9591e3fdbb9b00a74ccb45364de68a7d33fed0a65d00ab68ec696528320b0321a1fac
|
7
|
+
data.tar.gz: 9d5cf6118e614100257bc7959357da6206e9f40f6bb07c7cc010e66be5c7d30f32e7629aee92b3cbac5e85780e0add3da4334e9267c5a0b42ed761b9c87ab476
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
# git-pr-release
|
2
2
|
|
3
|
+
## v2.2.0 (2022-08-17)
|
4
|
+
|
5
|
+
[full changelog](https://github.com/x-motemen/git-pr-release/compare/v2.1.2...v2.2.0)
|
6
|
+
|
7
|
+
* (#88) unshallow if a shallow repository (@Songmu)
|
8
|
+
* (#89) Add overwrite-description option (@onk)
|
9
|
+
|
10
|
+
## v2.1.2 (2022-07-29)
|
11
|
+
|
12
|
+
[full changelog](https://github.com/x-motemen/git-pr-release/compare/v2.1.1...v2.1.2)
|
13
|
+
|
14
|
+
* (#87) delegate to `@pr` when `method_missing` in PullRequest (@Songmu)
|
15
|
+
|
16
|
+
## v2.1.1 (2022-03-09)
|
17
|
+
|
18
|
+
[full changelog](https://github.com/x-motemen/git-pr-release/compare/v2.1.0...v2.1.1)
|
19
|
+
|
20
|
+
* (#81) fix forbidden git config name (#80) (@mtgto)
|
21
|
+
|
3
22
|
## v2.1.0 (2022-03-03)
|
4
23
|
|
5
24
|
[full changelog](https://github.com/x-motemen/git-pr-release/compare/v2.0.0...v2.1.0)
|
data/README.md
CHANGED
@@ -84,7 +84,7 @@ You can specify this value by `GIT_PR_RELEASE_MENTION` environment variable.
|
|
84
84
|
|
85
85
|
If not specified, the mention will be the PR assignee
|
86
86
|
|
87
|
-
|
87
|
+
### `pr-release.ssl-no-verify`
|
88
88
|
|
89
89
|
Whether to verify SSL certificate or not.
|
90
90
|
Accepted values: `true` | `false`
|
@@ -102,18 +102,6 @@ Errors and exit statuses
|
|
102
102
|
|
103
103
|
exit status is 1.
|
104
104
|
|
105
|
-
### Failed to create a new pull request
|
106
|
-
|
107
|
-
exit status is 2.
|
108
|
-
|
109
|
-
### Failed to update a pull request
|
110
|
-
|
111
|
-
exit status is 3.
|
112
|
-
|
113
|
-
### Failed to add labels
|
114
|
-
|
115
|
-
exit status is 4.
|
116
|
-
|
117
105
|
Author
|
118
106
|
------
|
119
107
|
|
data/git-pr-release.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "git-pr-release"
|
7
|
-
spec.version = '2.
|
7
|
+
spec.version = '2.2.0'
|
8
8
|
spec.authors = ["motemen"]
|
9
9
|
spec.email = ["motemen@gmail.com"]
|
10
10
|
spec.summary = 'Creates a release pull request'
|
data/lib/git/pr/release/cli.rb
CHANGED
@@ -34,6 +34,9 @@ module Git
|
|
34
34
|
opts.on('--squashed', 'Handle squash merged PRs') do |v|
|
35
35
|
@squashed = v
|
36
36
|
end
|
37
|
+
opts.on('--overwrite-description', 'Force overwrite PR description') do |v|
|
38
|
+
@overwrite_description = v
|
39
|
+
end
|
37
40
|
end.parse!
|
38
41
|
|
39
42
|
### Set up configuration
|
@@ -59,8 +62,8 @@ module Git
|
|
59
62
|
host, @repository, scheme = host_and_repository_and_scheme
|
60
63
|
|
61
64
|
if host
|
62
|
-
if
|
63
|
-
ssl_no_verify = %w[true 1].include? ENV.fetch('GIT_PR_RELEASE_SSL_NO_VERIFY') { git_config('
|
65
|
+
if scheme == 'https' # GitHub Enterprise
|
66
|
+
ssl_no_verify = %w[true 1].include? ENV.fetch('GIT_PR_RELEASE_SSL_NO_VERIFY') { git_config('ssl-no-verify') }
|
64
67
|
if ssl_no_verify
|
65
68
|
OpenSSL::SSL.const_set :VERIFY_PEER, OpenSSL::SSL::VERIFY_NONE
|
66
69
|
end
|
@@ -87,6 +90,10 @@ module Git
|
|
87
90
|
end
|
88
91
|
|
89
92
|
def fetch_merged_prs
|
93
|
+
bool = git(:'rev-parse', '--is-shallow-repository').first.chomp
|
94
|
+
if bool == 'true'
|
95
|
+
git(:fetch, '--unshallow')
|
96
|
+
end
|
90
97
|
git :remote, 'update', 'origin' unless @no_fetch
|
91
98
|
|
92
99
|
merged_pull_request_numbers = fetch_merged_pr_numbers_from_git_remote
|
@@ -191,7 +198,11 @@ module Git
|
|
191
198
|
changed_files = pull_request_files(release_pr)
|
192
199
|
end
|
193
200
|
|
194
|
-
pr_title, pr_body =
|
201
|
+
pr_title, pr_body = if @overwrite_description
|
202
|
+
build_pr_title_and_body(release_pr, merged_prs, changed_files, template_path)
|
203
|
+
else
|
204
|
+
build_and_merge_pr_title_and_body(release_pr, merged_prs, changed_files)
|
205
|
+
end
|
195
206
|
|
196
207
|
if @dry_run
|
197
208
|
say 'Dry-run. Not updating PR', :info
|
@@ -40,6 +40,14 @@ module Git
|
|
40
40
|
def self.mention_type
|
41
41
|
@mention_type ||= (ENV.fetch('GIT_PR_RELEASE_MENTION') { git_config('mention') } || 'default')
|
42
42
|
end
|
43
|
+
|
44
|
+
def method_missing(name, *args, &block)
|
45
|
+
@pr.public_send name, *args, &block
|
46
|
+
end
|
47
|
+
|
48
|
+
def respond_to_missing?(name, include_private = false)
|
49
|
+
@pr.respond_to?(name, include_private)
|
50
|
+
end
|
43
51
|
end
|
44
52
|
end
|
45
53
|
end
|
@@ -194,6 +194,7 @@ RSpec.describe Git::Pr::Release::CLI do
|
|
194
194
|
conn.adapter(:test, Faraday::Adapter::Test::Stubs.new)
|
195
195
|
end
|
196
196
|
|
197
|
+
expect(@cli).to receive(:git).with(:'rev-parse', "--is-shallow-repository") { ["false\n"] }
|
197
198
|
expect(@cli).to receive(:git).with(:remote, "update", "origin") {
|
198
199
|
[]
|
199
200
|
}
|
@@ -319,6 +320,32 @@ RSpec.describe Git::Pr::Release::CLI do
|
|
319
320
|
expect(@cli).not_to have_received(:update_release_pr).with(@created_pr, @pr_title, @pr_body)
|
320
321
|
}
|
321
322
|
end
|
323
|
+
|
324
|
+
context "When overwrite_description" do
|
325
|
+
before {
|
326
|
+
@cli.instance_variable_set(:@overwrite_description, true)
|
327
|
+
@new_pr_title = "2022-08-17 12:34:58 +0900"
|
328
|
+
@new_pr_body = <<~BODY.chomp
|
329
|
+
- [ ] #3 @hakobe
|
330
|
+
- [ ] #4 @hakobe
|
331
|
+
BODY
|
332
|
+
allow(@cli).to receive(:build_pr_title_and_body) {
|
333
|
+
[@new_pr_title, @new_pr_body]
|
334
|
+
}
|
335
|
+
}
|
336
|
+
|
337
|
+
let(:existing_release_pr) { double(
|
338
|
+
number: 1023,
|
339
|
+
rels: { html: double(href: "https://github.com/motemen/git-pr-release/pull/1023") },
|
340
|
+
)}
|
341
|
+
|
342
|
+
it {
|
343
|
+
subject
|
344
|
+
|
345
|
+
expect(@cli).not_to have_received(:build_and_merge_pr_title_and_body)
|
346
|
+
expect(@cli).to have_received(:update_release_pr).with(existing_release_pr, @new_pr_title, @new_pr_body)
|
347
|
+
}
|
348
|
+
end
|
322
349
|
end
|
323
350
|
|
324
351
|
describe "#prepare_release_pr" do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-pr-release
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- motemen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|