octokit 4.21.0 → 4.22.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be4c54d083639a915bef0eb235748b93351f17f2a98e204b7b9f2899c156f2f6
4
- data.tar.gz: 21998779cea8f95e63b1814dc264102c1ac69c9d66fef6694ef6442554419bbc
3
+ metadata.gz: 072c9ec7fa2439cc75655ff5c925efeedc19fe386eae30a30be712524802b3ad
4
+ data.tar.gz: 177806faf28428ecd942d0159c268cae122e2ec7a88d4bc3e0b34e41a2b3409c
5
5
  SHA512:
6
- metadata.gz: 14221c5912859f6fa1a9f3dce7d7ee1cb6b5730bc1a95c997e84ff2972f23a3e8eaad723acbabd57982afadc1f4bb1538af510bd10583e21e0f208c7712ce1e6
7
- data.tar.gz: 23300ee9b4e73fc660a391018efbc969742dbdc9740faa57ed7609853830689cc1edcca8d445df2d939f2d7353056f828b53ad44b33269573ed06a8e93b8dbd4
6
+ metadata.gz: 7a087ec2c360f33db0cd6526ba76ae8762d57885a24577d36ada1baf1cf3019e93beeaa70455bb6cf08f64d9328e84112043d202526b42e94f8cb1bfb96faada
7
+ data.tar.gz: 8425341fe9135936b066de860c2722ad77b8a3c3ce2d8fe478a5420a3c911fc56a419ce4808a290f55199074bab94953500d3cdbc7345f9d9137d66cccb9de39
data/README.md CHANGED
@@ -584,7 +584,9 @@ stack = Faraday::RackBuilder.new do |builder|
584
584
  builder.use Octokit::Middleware::FollowRedirects
585
585
  builder.use Octokit::Response::RaiseError
586
586
  builder.use Octokit::Response::FeedParser
587
- builder.response :logger
587
+ builder.response :logger do |logger|
588
+ logger.filter(/(Authorization: "(token|Bearer) )(\w+)/, '\1[REMOVED]')
589
+ end
588
590
  builder.adapter Faraday.default_adapter
589
591
  end
590
592
  Octokit.middleware = stack
@@ -189,13 +189,18 @@ module Octokit
189
189
 
190
190
  # Compare two commits
191
191
  #
192
+ # When using auto_pagination, commits from all pages will be concatenated
193
+ # into the <tt>commits</tt> attribute of the first page's response.
194
+ #
192
195
  # @param repo [Integer, String, Hash, Repository] A GitHub repository
193
196
  # @param start [String] The sha of the starting commit
194
197
  # @param endd [String] The sha of the ending commit
195
198
  # @return [Sawyer::Resource] A hash representing the comparison
196
199
  # @see https://developer.github.com/v3/repos/commits/#compare-two-commits
197
200
  def compare(repo, start, endd, options = {})
198
- get "#{Repository.path repo}/compare/#{start}...#{endd}", options
201
+ paginate "#{Repository.path repo}/compare/#{start}...#{endd}", options do |data, last_response|
202
+ data.commits.concat last_response.data.commits
203
+ end
199
204
  end
200
205
 
201
206
  # Merge a branch or sha
@@ -731,7 +731,7 @@ module Octokit
731
731
  # @return [Sawyer::Resource] Hash representing the new migration.
732
732
  # @example
733
733
  # @client.start_migration('github', ['github/dotfiles'])
734
- # @see https://developer.github.com/v3/orgs/migrations/#start-a-migration
734
+ # @see https://docs.github.com/en/rest/reference/migrations#start-an-organization-migration
735
735
  def start_migration(org, repositories, options = {})
736
736
  options = ensure_api_media_type(:migrations, options)
737
737
  options[:repositories] = repositories
@@ -744,7 +744,7 @@ module Octokit
744
744
  #
745
745
  # @param org [String, Integer] Organization GitHub login or id.
746
746
  # @return [Array<Sawyer::Resource>] Array of migration resources.
747
- # @see https://developer.github.com/v3/orgs/migrations/#get-a-list-of-migrations
747
+ # @see https://docs.github.com/en/rest/reference/migrations#list-organization-migrations
748
748
  def migrations(org, options = {})
749
749
  options = ensure_api_media_type(:migrations, options)
750
750
  paginate "#{Organization.path(org)}/migrations", options
@@ -756,7 +756,7 @@ module Octokit
756
756
  #
757
757
  # @param org [String, Integer] Organization GitHub login or id.
758
758
  # @param id [Integer] ID number of the migration.
759
- # @see https://developer.github.com/v3/orgs/migrations/#get-the-status-of-a-migration
759
+ # @see https://docs.github.com/en/rest/reference/migrations#get-an-organization-migration-status
760
760
  def migration_status(org, id, options = {})
761
761
  options = ensure_api_media_type(:migrations, options)
762
762
  get "#{Organization.path(org)}/migrations/#{id}", options
@@ -768,7 +768,7 @@ module Octokit
768
768
  #
769
769
  # @param org [String, Integer] Organization GitHub login or id.
770
770
  # @param id [Integer] ID number of the migration.
771
- # @see https://developer.github.com/v3/orgs/migrations/#download-a-migration-archive
771
+ # @see https://docs.github.com/en/rest/reference/migrations#download-an-organization-migration-archive
772
772
  def migration_archive_url(org, id, options = {})
773
773
  options = ensure_api_media_type(:migrations, options)
774
774
  url = "#{Organization.path(org)}/migrations/#{id}/archive"
@@ -783,7 +783,7 @@ module Octokit
783
783
  #
784
784
  # @param org [String, Integer] Organization GitHub login or id.
785
785
  # @param id [Integer] ID number of the migration.
786
- # @see https://developer.github.com/v3/orgs/migrations/#delete-a-migration-archive
786
+ # @see https://docs.github.com/en/rest/reference/migrations#delete-an-organization-migration-archive
787
787
  def delete_migration_archive(org, id, options = {})
788
788
  options = ensure_api_media_type(:migrations, options)
789
789
  delete "#{Organization.path(org)}/migrations/#{id}/archive", options
@@ -796,7 +796,7 @@ module Octokit
796
796
  # @param org [String, Integer] Organization GitHub login or id.
797
797
  # @param id [Integer] ID number of the migration.
798
798
  # @param repo [String] Name of the repository.
799
- # @see https://developer.github.com/v3/orgs/migrations/#unlock-a-repository
799
+ # @see https://docs.github.com/en/rest/reference/migrations#unlock-an-organization-repository
800
800
  def unlock_repository(org, id, repo, options = {})
801
801
  options = ensure_api_media_type(:migrations, options)
802
802
  delete "#{Organization.path(org)}/migrations/#{id}/repos/#{repo}/lock", options
@@ -91,9 +91,9 @@ module Octokit
91
91
  conn = Faraday.new(:url => @api_endpoint) do |http|
92
92
  http.headers[:user_agent] = user_agent
93
93
  if basic_authenticated?
94
- http.basic_auth(@login, @password)
94
+ http.request :basic_auth, @login, @password
95
95
  elsif token_authenticated?
96
- http.authorization 'token', @access_token
96
+ http.request :authorization, 'token', @access_token
97
97
  end
98
98
  http.request :url_encoded
99
99
  http.use Octokit::Response::RaiseError
@@ -58,7 +58,7 @@ module Octokit
58
58
  # @example Create refs/heads/master for octocat/Hello-World with sha 827efc6d56897b048c772eb4087f854f46256132
59
59
  # Octokit.create_ref("octocat/Hello-World", "heads/master", "827efc6d56897b048c772eb4087f854f46256132")
60
60
  def create_ref(repo, ref, sha, options = {})
61
- ref = "refs/#{ref}" unless ref =~ %r{refs/}
61
+ ref = "refs/#{ref}" unless ref =~ %r{\Arefs/}
62
62
  parameters = {
63
63
  :ref => ref,
64
64
  :sha => sha
@@ -238,11 +238,11 @@ module Octokit
238
238
  conn_opts[:ssl] = { :verify_mode => @ssl_verify_mode } if @ssl_verify_mode
239
239
  conn = Faraday.new(conn_opts) do |http|
240
240
  if basic_authenticated?
241
- http.basic_auth(@login, @password)
241
+ http.request :basic_auth, @login, @password
242
242
  elsif token_authenticated?
243
- http.authorization 'token', @access_token
243
+ http.request :authorization, 'token', @access_token
244
244
  elsif bearer_authenticated?
245
- http.authorization 'Bearer', @bearer_token
245
+ http.request :authorization, 'Bearer', @bearer_token
246
246
  end
247
247
  http.headers['accept'] = options[:accept] if options.key?(:accept)
248
248
  end
@@ -107,13 +107,13 @@ module Octokit
107
107
  http.headers[:content_type] = "application/json"
108
108
  http.headers[:user_agent] = user_agent
109
109
  if basic_authenticated?
110
- http.basic_auth(@login, @password)
110
+ http.request :basic_auth, @login, @password
111
111
  elsif token_authenticated?
112
- http.authorization 'token', @access_token
112
+ http.request :authorization, 'token', @access_token
113
113
  elsif bearer_authenticated?
114
- http.authorization 'Bearer', @bearer_token
114
+ http.request :authorization, 'Bearer', @bearer_token
115
115
  elsif application_authenticated?
116
- http.basic_auth(@client_id, @client_secret)
116
+ http.request :basic_auth, @client_id, @client_secret
117
117
  end
118
118
  end
119
119
  end
@@ -176,7 +176,7 @@ module Octokit
176
176
  :links_parser => Sawyer::LinkParsers::Simple.new
177
177
  }
178
178
  conn_opts = @connection_options
179
- conn_opts[:builder] = @middleware if @middleware
179
+ conn_opts[:builder] = @middleware.dup if @middleware
180
180
  conn_opts[:proxy] = @proxy if @proxy
181
181
  if conn_opts[:ssl].nil?
182
182
  conn_opts[:ssl] = { :verify_mode => @ssl_verify_mode } if @ssl_verify_mode
@@ -86,7 +86,10 @@ module Octokit
86
86
  original_url = env[:url]
87
87
  env[:url] += safe_escape(response["location"])
88
88
  unless same_host?(original_url, env[:url])
89
- env[:request_headers].delete("Authorization")
89
+ # HACK: Faraday’s Authorization middlewares don’t touch the request if the `Authorization` header is set.
90
+ # This is a workaround to drop authentication info.
91
+ # See https://github.com/octokit/octokit.rb/pull/1359#issuecomment-925609697
92
+ env[:request_headers]["Authorization"] = "dummy"
90
93
  end
91
94
 
92
95
  if convert_to_get?(response)
@@ -5,7 +5,7 @@ module Octokit
5
5
 
6
6
  # Current minor release.
7
7
  # @return [Integer]
8
- MINOR = 21
8
+ MINOR = 22
9
9
 
10
10
  # Current patch level.
11
11
  # @return [Integer]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octokit
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.21.0
4
+ version: 4.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wynn Netherland
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-04-26 00:00:00.000000000 Z
13
+ date: 2022-01-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
180
  - !ruby/object:Gem::Version
181
181
  version: 1.3.5
182
182
  requirements: []
183
- rubygems_version: 3.0.3
183
+ rubygems_version: 3.1.2
184
184
  signing_key:
185
185
  specification_version: 4
186
186
  summary: Ruby toolkit for working with the GitHub API