git-pr-release 2.0.0 → 2.1.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/CHANGELOG.md +9 -0
- data/README.md +10 -0
- data/git-pr-release.gemspec +1 -1
- data/lib/git/pr/release/cli.rb +53 -8
- data/lib/git/pr/release/pull_request.rb +6 -2
- 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: e1a94b83554ecc020acc0a736dcec3d764e416cd0a99ea2b3a1948b9b2a85fb6
|
4
|
+
data.tar.gz: 2d41363fc87ca3d42e21b8bf18348f2ff9ef6f2e4a53237c4292338e62a9e257
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbb6731c6b4805a9bf512d727641a8e73bc4bf50261c2e821d1a17beeba359a1c2c2ed234269c7b4e05d3d08378ad225ad84955008c055ad6c7bbbe0993db43f
|
7
|
+
data.tar.gz: ac651dbda5be13ed6fd43db65baee451e5dba97723c79c7eaa7ca44c1214500651a10a93f8e8c911062d772c8ead1726edcb5c06a1bf2c9214ff1380406b827d
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# git-pr-release
|
2
2
|
|
3
|
+
## v2.1.0 (2022-03-03)
|
4
|
+
|
5
|
+
[full changelog](https://github.com/x-motemen/git-pr-release/compare/v2.0.0...v2.1.0)
|
6
|
+
|
7
|
+
* (#75) reduce GitHub search API calls when the squashed option is specified (@Songmu)
|
8
|
+
* (#76) use bulk issue search to reduce API calls (@Songmu)
|
9
|
+
* (#77) Add option "ssl_no_verify" to skip verifying ssl certificate (@mtgto)
|
10
|
+
* (#78) add an argument to to_checklist_item to print pr title (@mtgto)
|
11
|
+
|
3
12
|
## v2.0.0 (2022-02-17)
|
4
13
|
|
5
14
|
[full changelog](https://github.com/x-motemen/git-pr-release/compare/v1.9.0...v2.0.0)
|
data/README.md
CHANGED
@@ -84,6 +84,16 @@ 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
|
+
## `pr-release.ssl_no_verify`
|
88
|
+
|
89
|
+
Whether to verify SSL certificate or not.
|
90
|
+
Accepted values: `true` | `false`
|
91
|
+
|
92
|
+
This option might be useful when self-hosted GitHub enterprise server is using self-signed certificate.
|
93
|
+
|
94
|
+
You can specify this value by `GIT_PR_RELEASE_SSL_NO_VERIFY` to `1`.
|
95
|
+
|
96
|
+
If not specified, verify SSL certificate always.
|
87
97
|
|
88
98
|
Errors and exit statuses
|
89
99
|
------------------------
|
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.1.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
@@ -59,8 +59,12 @@ module Git
|
|
59
59
|
host, @repository, scheme = host_and_repository_and_scheme
|
60
60
|
|
61
61
|
if host
|
62
|
-
# GitHub
|
63
|
-
|
62
|
+
if host != 'github.com' && scheme == 'https' # GitHub Enterprise
|
63
|
+
ssl_no_verify = %w[true 1].include? ENV.fetch('GIT_PR_RELEASE_SSL_NO_VERIFY') { git_config('ssl_no_verify') }
|
64
|
+
if ssl_no_verify
|
65
|
+
OpenSSL::SSL.const_set :VERIFY_PEER, OpenSSL::SSL::VERIFY_NONE
|
66
|
+
end
|
67
|
+
end
|
64
68
|
|
65
69
|
Octokit.configure do |c|
|
66
70
|
c.api_endpoint = "#{scheme}://#{host}/api/v3"
|
@@ -85,7 +89,10 @@ module Git
|
|
85
89
|
def fetch_merged_prs
|
86
90
|
git :remote, 'update', 'origin' unless @no_fetch
|
87
91
|
|
88
|
-
merged_pull_request_numbers =
|
92
|
+
merged_pull_request_numbers = fetch_merged_pr_numbers_from_git_remote
|
93
|
+
if @squashed
|
94
|
+
merged_pull_request_numbers.concat(fetch_squash_merged_pr_numbers_from_github)
|
95
|
+
end
|
89
96
|
|
90
97
|
merged_prs = merged_pull_request_numbers.uniq.sort.map do |nr|
|
91
98
|
pr = client.pull_request repository, nr
|
@@ -122,11 +129,49 @@ module Git
|
|
122
129
|
end.compact
|
123
130
|
end
|
124
131
|
|
125
|
-
def
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
132
|
+
def search_issue_numbers(query)
|
133
|
+
sleep 1
|
134
|
+
say "search issues with query:#{query}", :debug
|
135
|
+
# Fortunately, we don't need to take care of the page count in response, because
|
136
|
+
# the default value of per_page is 30 and we can't specify more than 30 commits due to
|
137
|
+
# the length limit specification of the query string.
|
138
|
+
client.search_issues("#{query}")[:items].map(&:number)
|
139
|
+
end
|
140
|
+
|
141
|
+
def fetch_squash_merged_pr_numbers_from_github
|
142
|
+
# When "--abbrev" is specified, the length of the each line of the stdout isn't fixed.
|
143
|
+
# It is just a minimum length, and if the commit cannot be uniquely identified with
|
144
|
+
# that length, a longer commit hash will be displayed.
|
145
|
+
# We specify this option to minimize the length of the query string, but we use
|
146
|
+
# "--abbrev=7" because the SHA syntax of the search API requires a string of at
|
147
|
+
# least 7 characters.
|
148
|
+
# ref. https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-requests#search-by-commit-sha
|
149
|
+
# This is done because there is a length limit on the API query string, and we want
|
150
|
+
# to create a string with the minimum possible length.
|
151
|
+
shas = git(:log, '--pretty=format:%h', "--abbrev=7", "--no-merges", "--first-parent",
|
152
|
+
"origin/#{production_branch}..origin/#{staging_branch}").map(&:chomp)
|
153
|
+
|
154
|
+
pr_nums = []
|
155
|
+
query_base = "repo:#{repository} is:pr is:closed"
|
156
|
+
query = query_base
|
157
|
+
# Make bulk requests with multiple SHAs of the maximum possible length.
|
158
|
+
# If multiple SHAs are specified, the issue search API will treat it like an OR search,
|
159
|
+
# and all the pull requests will be searched.
|
160
|
+
# This is difficult to read from the current documentation, but that is the current
|
161
|
+
# behavior and GitHub support has responded that this is the spec.
|
162
|
+
shas.each do |sha|
|
163
|
+
# Longer than 256 characters are not supported in the query.
|
164
|
+
# ref. https://docs.github.com/en/rest/reference/search#limitations-on-query-length
|
165
|
+
if query.length + 1 + sha.length >= 256
|
166
|
+
pr_nums.concat(search_issue_numbers(query))
|
167
|
+
query = query_base
|
168
|
+
end
|
169
|
+
query += " " + sha
|
170
|
+
end
|
171
|
+
if query != query_base
|
172
|
+
pr_nums.concat(search_issue_numbers(query))
|
173
|
+
end
|
174
|
+
pr_nums
|
130
175
|
end
|
131
176
|
|
132
177
|
def create_release_pr(merged_prs)
|
@@ -10,8 +10,12 @@ module Git
|
|
10
10
|
@pr = pr
|
11
11
|
end
|
12
12
|
|
13
|
-
def to_checklist_item
|
14
|
-
|
13
|
+
def to_checklist_item(print_title = false)
|
14
|
+
if print_title
|
15
|
+
"- [ ] ##{pr.number} #{pr.title}" + mention
|
16
|
+
else
|
17
|
+
"- [ ] ##{pr.number}" + mention
|
18
|
+
end
|
15
19
|
end
|
16
20
|
|
17
21
|
def html_link
|
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.1.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-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|