git-pr-release 1.6.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +47 -0
- data/CHANGELOG.md +27 -0
- data/git-pr-release.gemspec +1 -1
- data/lib/git/pr/release/cli.rb +3 -3
- data/lib/git/pr/release/pull_request.rb +1 -1
- data/spec/git/pr/release/cli_spec.rb +8 -8
- data/spec/git/pr/release_spec.rb +6 -6
- data/spec/support/file_fixture_support.rb +8 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8bcbbdbe3dfb5b6783306e29dad9c919d86264ea185742aeb07b91d141ac247
|
4
|
+
data.tar.gz: 1d67e25f3acde325baf9a1103ecc619011486847def7e561aa620f9b0f538c9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 602b5171e7b0a0160555632b19ff35af9ca7bf9c6d560d4364d8251b661cc205b51f645c15d33db701c623817f5ad31c6e307781178a6103582f35f001b06fb1
|
7
|
+
data.tar.gz: 1fad3d9128cc3d982ceb426045013566967d53df7c25364d8b256562863286384b297bbcf14aa0df4acaa81b945e3c570ddef7559c30dbff2a5fe77a41231141
|
@@ -0,0 +1,47 @@
|
|
1
|
+
name: test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
schedule:
|
9
|
+
- cron: "0 0 * * *" # JST 09:00
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
test:
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
container: ${{ matrix.ruby }}
|
15
|
+
strategy:
|
16
|
+
fail-fast: false
|
17
|
+
matrix:
|
18
|
+
ruby:
|
19
|
+
- ruby:2.6
|
20
|
+
- ruby:2.7
|
21
|
+
- ruby:3.0
|
22
|
+
- rubylang/ruby:master-nightly-bionic
|
23
|
+
include:
|
24
|
+
- ruby: rubylang/ruby:master-nightly-bionic
|
25
|
+
allow_failures: "true"
|
26
|
+
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v2
|
29
|
+
- name: Cache vendor/bundle
|
30
|
+
uses: actions/cache@v2
|
31
|
+
with:
|
32
|
+
path: vendor/bundle
|
33
|
+
key: v1-gem-${{ runner.os }}-${{ matrix.ruby }}-${{ github.sha }}
|
34
|
+
restore-keys: |
|
35
|
+
v1-gem-${{ runner.os }}-${{ matrix.ruby }}-
|
36
|
+
continue-on-error: ${{ matrix.allow_failures == 'true' }}
|
37
|
+
- name: bundle update
|
38
|
+
run: |
|
39
|
+
set -xe
|
40
|
+
bundle config path vendor/bundle
|
41
|
+
bundle update --jobs $(nproc) --retry 3
|
42
|
+
continue-on-error: ${{ matrix.allow_failures == 'true' }}
|
43
|
+
- name: Run ${{ matrix.test_framework }}
|
44
|
+
run: |
|
45
|
+
set -xe
|
46
|
+
bundle exec rspec
|
47
|
+
continue-on-error: ${{ matrix.allow_failures == 'true' }}
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,32 @@
|
|
1
1
|
# git-pr-release
|
2
2
|
|
3
|
+
## v2.0.0 (2022-02-17)
|
4
|
+
|
5
|
+
[full changelog](https://github.com/x-motemen/git-pr-release/compare/v1.9.0...v2.0.0)
|
6
|
+
|
7
|
+
* (#69) remove duplicated PR entries at squash (@Yuki-Inoue)
|
8
|
+
* (#70) [Spec] Fix spec for build_pr_title_and_body (@yutailang0119)
|
9
|
+
* (#71) Introduce CI (@ohbarye)
|
10
|
+
* (#73) (#74) Use `YAML.unsafe_load_file` instead of `YAML.load_file` (@ohbarye)
|
11
|
+
|
12
|
+
## v1.9.0 (2021-08-04)
|
13
|
+
|
14
|
+
[full changelog](https://github.com/x-motemen/git-pr-release/compare/v1.8.0...v1.9.0)
|
15
|
+
|
16
|
+
* (#68) Add nil check for release\_pr.body (@w1mvy)
|
17
|
+
|
18
|
+
## v1.8.0 (2021-06-24)
|
19
|
+
|
20
|
+
[full changelog](https://github.com/x-motemen/git-pr-release/compare/v1.7.0...v1.8.0)
|
21
|
+
|
22
|
+
* (#66) Exclude titles from checklist items (@nhosoya)
|
23
|
+
|
24
|
+
## v1.7.0 (2021-05-24)
|
25
|
+
|
26
|
+
[full changelog](https://github.com/x-motemen/git-pr-release/compare/v1.6.0...v1.7.0)
|
27
|
+
|
28
|
+
* (#64) fix wrong pr number due to sleep (@mpon)
|
29
|
+
|
3
30
|
## v1.6.0 (2021-05-15)
|
4
31
|
|
5
32
|
[full changelog](https://github.com/x-motemen/git-pr-release/compare/v1.5.0...v1.6.0)
|
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 = '
|
7
|
+
spec.version = '2.0.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
@@ -87,7 +87,7 @@ module Git
|
|
87
87
|
|
88
88
|
merged_pull_request_numbers = @squashed ? fetch_merged_pr_numbers_from_github : fetch_merged_pr_numbers_from_git_remote
|
89
89
|
|
90
|
-
merged_prs = merged_pull_request_numbers.sort.map do |nr|
|
90
|
+
merged_prs = merged_pull_request_numbers.uniq.sort.map do |nr|
|
91
91
|
pr = client.pull_request repository, nr
|
92
92
|
say "To be released: ##{pr.number} #{pr.title}", :notice
|
93
93
|
pr
|
@@ -124,8 +124,8 @@ module Git
|
|
124
124
|
|
125
125
|
def fetch_merged_pr_numbers_from_github
|
126
126
|
git(:log, '--pretty=format:%H', "origin/#{production_branch}..origin/#{staging_branch}").map(&:chomp).map do |sha1|
|
127
|
-
client.search_issues("repo:#{repository} is:pr is:closed #{sha1}")[:items].map(&:number)
|
128
127
|
sleep 1
|
128
|
+
client.search_issues("repo:#{repository} is:pr is:closed #{sha1}")[:items].map(&:number)
|
129
129
|
end.flatten
|
130
130
|
end
|
131
131
|
|
@@ -176,7 +176,7 @@ module Git
|
|
176
176
|
|
177
177
|
def build_and_merge_pr_title_and_body(release_pr, merged_prs, changed_files)
|
178
178
|
# release_pr is nil when dry_run && create_mode
|
179
|
-
old_body = release_pr ? release_pr.body : ""
|
179
|
+
old_body = (release_pr && release_pr.body != nil) ? release_pr.body : ""
|
180
180
|
pr_title, new_body = build_pr_title_and_body(release_pr, merged_prs, changed_files, template_path)
|
181
181
|
|
182
182
|
[pr_title, merge_pr_body(old_body, new_body)]
|
@@ -36,8 +36,8 @@ RSpec.describe Git::Pr::Release::CLI do
|
|
36
36
|
conn.builder.handlers.delete(Faraday::Adapter::NetHttp)
|
37
37
|
conn.adapter(:test, Faraday::Adapter::Test::Stubs.new)
|
38
38
|
end
|
39
|
-
pr_3 = Sawyer::Resource.new(agent,
|
40
|
-
pr_4 = Sawyer::Resource.new(agent,
|
39
|
+
pr_3 = Sawyer::Resource.new(agent, load_yaml("pr_3.yml"))
|
40
|
+
pr_4 = Sawyer::Resource.new(agent, load_yaml("pr_4.yml"))
|
41
41
|
[pr_3, pr_4]
|
42
42
|
}
|
43
43
|
it {
|
@@ -219,8 +219,8 @@ RSpec.describe Git::Pr::Release::CLI do
|
|
219
219
|
}
|
220
220
|
|
221
221
|
client = double(Octokit::Client)
|
222
|
-
@pr_3 = Sawyer::Resource.new(agent,
|
223
|
-
@pr_4 = Sawyer::Resource.new(agent,
|
222
|
+
@pr_3 = Sawyer::Resource.new(agent, load_yaml("pr_3.yml"))
|
223
|
+
@pr_4 = Sawyer::Resource.new(agent, load_yaml("pr_4.yml"))
|
224
224
|
expect(client).to receive(:pull_request).with("motemen/git-pr-release", 3) { @pr_3 }
|
225
225
|
expect(client).to receive(:pull_request).with("motemen/git-pr-release", 4) { @pr_4 }
|
226
226
|
allow(@cli).to receive(:client).with(no_args) { client }
|
@@ -241,8 +241,8 @@ RSpec.describe Git::Pr::Release::CLI do
|
|
241
241
|
end
|
242
242
|
|
243
243
|
@merged_prs = [
|
244
|
-
Sawyer::Resource.new(@agent,
|
245
|
-
Sawyer::Resource.new(@agent,
|
244
|
+
Sawyer::Resource.new(@agent, load_yaml("pr_3.yml")),
|
245
|
+
Sawyer::Resource.new(@agent, load_yaml("pr_4.yml")),
|
246
246
|
]
|
247
247
|
|
248
248
|
allow(@cli).to receive(:detect_existing_release_pr) { existing_release_pr }
|
@@ -261,7 +261,7 @@ RSpec.describe Git::Pr::Release::CLI do
|
|
261
261
|
|
262
262
|
context "When create_mode" do
|
263
263
|
before {
|
264
|
-
@created_pr = Sawyer::Resource.new(@agent,
|
264
|
+
@created_pr = Sawyer::Resource.new(@agent, load_yaml("pr_1.yml"))
|
265
265
|
allow(@cli).to receive(:prepare_release_pr) { @created_pr }
|
266
266
|
}
|
267
267
|
|
@@ -301,7 +301,7 @@ RSpec.describe Git::Pr::Release::CLI do
|
|
301
301
|
|
302
302
|
context "When dry_run with create_mode" do
|
303
303
|
before {
|
304
|
-
@created_pr = Sawyer::Resource.new(@agent,
|
304
|
+
@created_pr = Sawyer::Resource.new(@agent, load_yaml("pr_1.yml"))
|
305
305
|
allow(@cli).to receive(:prepare_release_pr) { @created_pr }
|
306
306
|
|
307
307
|
@cli.instance_variable_set(:@dry_run, true)
|
data/spec/git/pr/release_spec.rb
CHANGED
@@ -8,13 +8,13 @@ RSpec.describe Git::Pr::Release do
|
|
8
8
|
conn.builder.handlers.delete(Faraday::Adapter::NetHttp)
|
9
9
|
conn.adapter :test, @stubs
|
10
10
|
end
|
11
|
-
@release_pr = Sawyer::Resource.new(@agent,
|
11
|
+
@release_pr = Sawyer::Resource.new(@agent, load_yaml("pr_1.yml"))
|
12
12
|
@merged_prs = [
|
13
|
-
Sawyer::Resource.new(@agent,
|
14
|
-
Sawyer::Resource.new(@agent,
|
13
|
+
Sawyer::Resource.new(@agent, load_yaml("pr_3.yml")),
|
14
|
+
Sawyer::Resource.new(@agent, load_yaml("pr_6.yml")),
|
15
15
|
]
|
16
16
|
@changed_files = [
|
17
|
-
Sawyer::Resource.new(@agent,
|
17
|
+
Sawyer::Resource.new(@agent, load_yaml("pr_1_files.yml")),
|
18
18
|
]
|
19
19
|
end
|
20
20
|
|
@@ -24,8 +24,8 @@ RSpec.describe Git::Pr::Release do
|
|
24
24
|
pr_title, new_body = build_pr_title_and_body(@release_pr, @merged_prs, @changed_files, nil)
|
25
25
|
expect(pr_title).to eq "Release 2019-02-20 22:58:35 +0900"
|
26
26
|
expect(new_body).to eq <<~MARKDOWN
|
27
|
-
- [ ] #3
|
28
|
-
- [ ] #6
|
27
|
+
- [ ] #3 @hakobe
|
28
|
+
- [ ] #6 @ninjinkun
|
29
29
|
MARKDOWN
|
30
30
|
}
|
31
31
|
end
|
@@ -1,4 +1,12 @@
|
|
1
1
|
module FileFixtureSupport
|
2
|
+
def load_yaml(fixture_name)
|
3
|
+
if YAML.respond_to?(:unsafe_load_file)
|
4
|
+
YAML.unsafe_load_file(file_fixture(fixture_name))
|
5
|
+
else
|
6
|
+
YAML.load_file(file_fixture(fixture_name))
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
2
10
|
def file_fixture(fixture_name)
|
3
11
|
file_fixture_path = RSpec.configuration.file_fixture_path
|
4
12
|
path = Pathname.new(File.join(file_fixture_path, fixture_name))
|
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:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- motemen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|
@@ -117,6 +117,7 @@ executables:
|
|
117
117
|
extensions: []
|
118
118
|
extra_rdoc_files: []
|
119
119
|
files:
|
120
|
+
- ".github/workflows/test.yml"
|
120
121
|
- ".gitignore"
|
121
122
|
- ".rspec"
|
122
123
|
- CHANGELOG.md
|
@@ -162,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
163
|
- !ruby/object:Gem::Version
|
163
164
|
version: '0'
|
164
165
|
requirements: []
|
165
|
-
rubygems_version: 3.
|
166
|
+
rubygems_version: 3.4.0.dev
|
166
167
|
signing_key:
|
167
168
|
specification_version: 4
|
168
169
|
summary: Creates a release pull request
|