git-pr-release 2.1.2 → 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 +7 -0
- data/README.md +0 -12
- data/git-pr-release.gemspec +1 -1
- data/lib/git/pr/release/cli.rb +12 -1
- data/spec/git/pr/release/cli_spec.rb +27 -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,12 @@
|
|
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
|
+
|
3
10
|
## v2.1.2 (2022-07-29)
|
4
11
|
|
5
12
|
[full changelog](https://github.com/x-motemen/git-pr-release/compare/v2.1.1...v2.1.2)
|
data/README.md
CHANGED
@@ -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
|
@@ -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
|
@@ -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
|
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
|