git-pr-release 1.4.0 → 1.5.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 +15 -5
- data/README.md +9 -0
- data/git-pr-release.gemspec +2 -2
- data/lib/git/pr/release/cli.rb +24 -11
- data/lib/git/pr/release/pull_request.rb +1 -1
- data/lib/git/pr/release/util.rb +5 -1
- data/spec/spec_helper.rb +9 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca8cbcbeabc642ad4c1531d0e06a30a321a1fcbbe726f02c796a8a770db03107
|
4
|
+
data.tar.gz: 7c394639183d32987a2676d7e78c8cc6d3426841d763e972058f7db765ca8218
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 318a4eaaed83ad8ff9f918a799864d9c4cb40224b3b168d41c073103d09b74af7c73cbe117ff54e1533cc182e4acbfd087949f42275f068eb4393e228761e573
|
7
|
+
data.tar.gz: 16dd7fc6cfa7f377644a4a8a342fb4fc1097c02f5fbd17794cc9f9e715d7fc2140a56952018295cc88100aec546919d2ada674258d7ce76cc71464239ac87b0d
|
data/CHANGELOG.md
CHANGED
@@ -1,21 +1,31 @@
|
|
1
1
|
# git-pr-release
|
2
2
|
|
3
|
+
## v1.5.0 (2021-04-02)
|
4
|
+
|
5
|
+
[full changelog](https://github.com/x-motemen/git-pr-release/compare/v1.4.0...v1.5.0)
|
6
|
+
|
7
|
+
* (#60, #61) Get issue number from GitHub API for squashed PR (@yuuan)
|
8
|
+
* (#58) Make stable test (@kachick)
|
9
|
+
* (#55) Suppress warning for ERB (@ohbarye)
|
10
|
+
* (#50) support `GIT_PR_RELEASE_MENTION` environment variable (@dabutvin)
|
11
|
+
* (#49) Transfer repository to x-motemen organization (@onk)
|
12
|
+
|
3
13
|
## v1.4.0 (2020-02-22)
|
4
14
|
|
5
|
-
[full changelog](https://github.com/motemen/git-pr-release/compare/v1.3.0...v1.4.0)
|
15
|
+
[full changelog](https://github.com/x-motemen/git-pr-release/compare/v1.3.0...v1.4.0)
|
6
16
|
|
7
17
|
* (#48) List PR API needs head user or head organization and branch name (@sasasin)
|
8
18
|
|
9
19
|
## v1.3.0 (2020-02-19)
|
10
20
|
|
11
|
-
[full changelog](https://github.com/motemen/git-pr-release/compare/v1.2.0...v1.3.0)
|
21
|
+
[full changelog](https://github.com/x-motemen/git-pr-release/compare/v1.2.0...v1.3.0)
|
12
22
|
|
13
23
|
* (#47) Fix Errno::ENOENT when finding the specified template (@onk)
|
14
24
|
* (#45) Fix "warning: instance variable @xxx not initialized" (@onk)
|
15
25
|
|
16
26
|
## v1.2.0 (2020-02-07)
|
17
27
|
|
18
|
-
[full changelog](https://github.com/motemen/git-pr-release/compare/v1.1.0...v1.2.0)
|
28
|
+
[full changelog](https://github.com/x-motemen/git-pr-release/compare/v1.1.0...v1.2.0)
|
19
29
|
|
20
30
|
* (#44) Use API option when detecting existing release PR (@onk)
|
21
31
|
* (#41, #42) Refactor (@onk)
|
@@ -23,13 +33,13 @@
|
|
23
33
|
|
24
34
|
## v1.1.0 (2020-01-02)
|
25
35
|
|
26
|
-
[full changelog](https://github.com/motemen/git-pr-release/compare/v1.0.1...v1.1.0)
|
36
|
+
[full changelog](https://github.com/x-motemen/git-pr-release/compare/v1.0.1...v1.1.0)
|
27
37
|
|
28
38
|
* (#38) Fetch changed files as many as possible (@shibayu36)
|
29
39
|
|
30
40
|
## v1.0.1 (2019-12-17)
|
31
41
|
|
32
|
-
[full changelog](https://github.com/motemen/git-pr-release/compare/v1.0.0...v1.0.1)
|
42
|
+
[full changelog](https://github.com/x-motemen/git-pr-release/compare/v1.0.0...v1.0.1)
|
33
43
|
|
34
44
|
* (#37) Fix NameError (@onk)
|
35
45
|
|
data/README.md
CHANGED
@@ -75,6 +75,15 @@ You can specify this value by `GIT_PR_RELEASE_LABELS` environment variable.
|
|
75
75
|
|
76
76
|
If not specified, any labels will not be added for PRs.
|
77
77
|
|
78
|
+
### `pr-release.mention`
|
79
|
+
|
80
|
+
The name that is listed next to each PR title.
|
81
|
+
Accepted values: `author`
|
82
|
+
|
83
|
+
You can specify this value by `GIT_PR_RELEASE_MENTION` environment variable.
|
84
|
+
|
85
|
+
If not specified, the mention will be the PR assignee
|
86
|
+
|
78
87
|
|
79
88
|
Errors and exit statuses
|
80
89
|
------------------------
|
data/git-pr-release.gemspec
CHANGED
@@ -4,12 +4,12 @@ $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 = '1.
|
7
|
+
spec.version = '1.5.0'
|
8
8
|
spec.authors = ["motemen"]
|
9
9
|
spec.email = ["motemen@gmail.com"]
|
10
10
|
spec.summary = 'Creates a release pull request'
|
11
11
|
spec.description = 'git-pr-release creates a pull request which summarizes feature branches that are to be released into production'
|
12
|
-
spec.homepage = 'https://github.com/motemen/git-pr-release'
|
12
|
+
spec.homepage = 'https://github.com/x-motemen/git-pr-release'
|
13
13
|
|
14
14
|
spec.files = `git ls-files`.split($/)
|
15
15
|
spec.bindir = "exe"
|
data/lib/git/pr/release/cli.rb
CHANGED
@@ -17,6 +17,7 @@ module Git
|
|
17
17
|
@dry_run = false
|
18
18
|
@json = false
|
19
19
|
@no_fetch = false
|
20
|
+
@squashed = false
|
20
21
|
end
|
21
22
|
|
22
23
|
def start
|
@@ -30,6 +31,9 @@ module Git
|
|
30
31
|
opts.on('--no-fetch', 'Do not fetch from remote repo before determining target PRs (CI friendly)') do |v|
|
31
32
|
@no_fetch = v
|
32
33
|
end
|
34
|
+
opts.on('--squashed', 'Handle squash merged PRs') do |v|
|
35
|
+
@squashed = v
|
36
|
+
end
|
33
37
|
end.parse!
|
34
38
|
|
35
39
|
### Set up configuration
|
@@ -81,14 +85,24 @@ module Git
|
|
81
85
|
def fetch_merged_prs
|
82
86
|
git :remote, 'update', 'origin' unless @no_fetch
|
83
87
|
|
84
|
-
|
85
|
-
|
86
|
-
|
88
|
+
merged_pull_request_numbers = @squashed ? fetch_merged_pr_numbers_from_github : fetch_merged_pr_numbers_from_git_remote
|
89
|
+
|
90
|
+
merged_prs = merged_pull_request_numbers.map do |nr|
|
91
|
+
pr = client.pull_request repository, nr
|
92
|
+
say "To be released: ##{pr.number} #{pr.title}", :notice
|
93
|
+
pr
|
94
|
+
end
|
95
|
+
|
96
|
+
merged_prs
|
97
|
+
end
|
98
|
+
|
99
|
+
def fetch_merged_pr_numbers_from_git_remote
|
100
|
+
merged_feature_head_sha1s = git(:log, '--merges', '--pretty=format:%P', "origin/#{production_branch}..origin/#{staging_branch}").map do |line|
|
87
101
|
main_sha1, feature_sha1 = line.chomp.split /\s+/
|
88
102
|
feature_sha1
|
89
103
|
end
|
90
104
|
|
91
|
-
|
105
|
+
git('ls-remote', 'origin', 'refs/pull/*/head').map do |line|
|
92
106
|
sha1, ref = line.chomp.split /\s+/
|
93
107
|
|
94
108
|
if merged_feature_head_sha1s.include? sha1
|
@@ -106,14 +120,13 @@ module Git
|
|
106
120
|
end
|
107
121
|
end
|
108
122
|
end.compact
|
123
|
+
end
|
109
124
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
end
|
115
|
-
|
116
|
-
merged_prs
|
125
|
+
def fetch_merged_pr_numbers_from_github
|
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
|
+
sleep 1
|
129
|
+
end.flatten
|
117
130
|
end
|
118
131
|
|
119
132
|
def create_release_pr(merged_prs)
|
data/lib/git/pr/release/util.rb
CHANGED
@@ -94,7 +94,11 @@ ERB
|
|
94
94
|
DEFAULT_PR_TEMPLATE
|
95
95
|
end
|
96
96
|
|
97
|
-
erb =
|
97
|
+
erb = if RUBY_VERSION >= '2.6'
|
98
|
+
ERB.new template, trim_mode: '-'
|
99
|
+
else
|
100
|
+
ERB.new template, nil, '-'
|
101
|
+
end
|
98
102
|
content = erb.result binding
|
99
103
|
content.split(/\n/, 2)
|
100
104
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -19,6 +19,15 @@ RSpec.configure do |config|
|
|
19
19
|
config.order = :random
|
20
20
|
Kernel.srand config.seed
|
21
21
|
|
22
|
+
config.around(:each) do |example|
|
23
|
+
begin
|
24
|
+
ENV['TZ'], old = 'Asia/Tokyo', ENV['TZ']
|
25
|
+
example.run
|
26
|
+
ensure
|
27
|
+
ENV['TZ'] = old
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
22
31
|
config.after do
|
23
32
|
Timecop.return
|
24
33
|
end
|
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: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- motemen
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|
@@ -143,11 +143,11 @@ files:
|
|
143
143
|
- spec/spec_helper.rb
|
144
144
|
- spec/support/capture_support.rb
|
145
145
|
- spec/support/file_fixture_support.rb
|
146
|
-
homepage: https://github.com/motemen/git-pr-release
|
146
|
+
homepage: https://github.com/x-motemen/git-pr-release
|
147
147
|
licenses:
|
148
148
|
- MIT
|
149
149
|
metadata: {}
|
150
|
-
post_install_message:
|
150
|
+
post_install_message:
|
151
151
|
rdoc_options: []
|
152
152
|
require_paths:
|
153
153
|
- lib
|
@@ -162,8 +162,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
162
|
- !ruby/object:Gem::Version
|
163
163
|
version: '0'
|
164
164
|
requirements: []
|
165
|
-
rubygems_version: 3.
|
166
|
-
signing_key:
|
165
|
+
rubygems_version: 3.2.3
|
166
|
+
signing_key:
|
167
167
|
specification_version: 4
|
168
168
|
summary: Creates a release pull request
|
169
169
|
test_files:
|