octokit 9.0.0 → 9.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/octokit/client/code_scanning.rb +138 -0
- data/lib/octokit/client/pull_requests.rb +16 -8
- data/lib/octokit/client/repositories.rb +43 -0
- data/lib/octokit/client.rb +2 -0
- data/lib/octokit/connection.rb +2 -0
- data/lib/octokit/default.rb +0 -5
- data/lib/octokit/enterprise_management_console_client/management_console.rb +19 -12
- data/lib/octokit/manage_ghes_client/manage_ghes.rb +8 -1
- data/lib/octokit/repository.rb +7 -1
- data/lib/octokit/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b64084ad94f7ab597007ce5baa5e9daa39e85c0270c0993cde6bf416a2834a2c
|
4
|
+
data.tar.gz: 429a34488349b5692bc28e6051571e3e4bddfd7f697be93bd0e24c7329d1bd18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c52b64720e7ffa14ab04bf59283194dd8a0b83ba73bf9acc3c0cfbb4ef36ba6e87257f7650969d597135c8c75eb3bc1bf7a3b7a20f2746c5670e92f7cea95a9f
|
7
|
+
data.tar.gz: b0598cc84a8d4571d9e3fc64d1ed63dcef618fba37e2d9e33346ef42a766e366bc2e38fc02b7c9561b0fc7fe28a7ed8984599390deb305f86af8e98b21033b29
|
@@ -9,6 +9,144 @@ module Octokit
|
|
9
9
|
#
|
10
10
|
# @see https://docs.github.com/rest/code-scanning
|
11
11
|
module CodeScanning
|
12
|
+
# Updates a code scanning default setup configuration
|
13
|
+
#
|
14
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
15
|
+
# @param state [String] The desired state of code scanning default setup
|
16
|
+
# @param query_suite [String] CodeQL query suite to be used
|
17
|
+
# @param languages [Array] List of CodeQL languages to be analyzed
|
18
|
+
#
|
19
|
+
# @return [Sawyer::Resource] Action Run information
|
20
|
+
# @see https://docs.github.com/en/rest/code-scanning/code-scanning#update-a-code-scanning-default-setup-configuration
|
21
|
+
def update_code_scanning_default_config(repo, state, query_suite = nil, languages = nil, options = {})
|
22
|
+
options[:state] = state
|
23
|
+
options[:query_suite] = query_suite if query_suite
|
24
|
+
options[:languages] = languages if languages
|
25
|
+
|
26
|
+
patch "#{Repository.path repo}/code-scanning/default-setup", options
|
27
|
+
end
|
28
|
+
|
29
|
+
# Get Code Scanning Default Configuration
|
30
|
+
#
|
31
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
32
|
+
#
|
33
|
+
# @return [Sawyer::Resource] CodeQl Default Setup Configuration Information
|
34
|
+
# @see https://docs.github.com/en/rest/code-scanning/code-scanning#get-a-code-scanning-default-setup-configuration
|
35
|
+
def get_code_scanning_default_config(repo, options = {})
|
36
|
+
get "#{Repository.path repo}/code-scanning/default-setup", options
|
37
|
+
end
|
38
|
+
|
39
|
+
# Gets a CodeQL database for a language in a repository
|
40
|
+
#
|
41
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
42
|
+
# @param language [String]
|
43
|
+
#
|
44
|
+
# @return [Sawyer::Resource] CodeQl Default Setup Configuration Information
|
45
|
+
# @see https://docs.github.com/en/rest/code-scanning/code-scanning#get-a-codeql-database-for-a-repository
|
46
|
+
def get_codeql_database_for_repo(repo, language, options = {})
|
47
|
+
get "#{Repository.path repo}/code-scanning/codeql/databases/#{language}", options
|
48
|
+
end
|
49
|
+
|
50
|
+
# Lists the CodeQL databases that are available in a repository
|
51
|
+
#
|
52
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
53
|
+
#
|
54
|
+
# @return [Array] List of CodeQL Databases
|
55
|
+
# @see https://docs.github.com/en/rest/code-scanning/code-scanning#list-codeql-databases-for-a-repository
|
56
|
+
def list_codeql_database_for_repo(repo, options = {})
|
57
|
+
get "#{Repository.path repo}/code-scanning/codeql/databases", options
|
58
|
+
end
|
59
|
+
|
60
|
+
# Delete a specified code scanning analysis from a repository
|
61
|
+
#
|
62
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
63
|
+
# @param analysis_id [Integer] ID of the code scanning analysis
|
64
|
+
#
|
65
|
+
# @return [Sawyer::Resource] Next Code Scanning Analysis Information
|
66
|
+
# @see https://docs.github.com/en/rest/code-scanning/code-scanning#delete-a-code-scanning-analysis-from-a-repository
|
67
|
+
def delete_code_scanning_analysis(repo, analysis_id, options = {})
|
68
|
+
delete "#{Repository.path repo}/code-scanning/analyses/#{analysis_id}", options
|
69
|
+
end
|
70
|
+
|
71
|
+
# Get a code scanning analysis for a repository
|
72
|
+
#
|
73
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
74
|
+
# @param analysis_id [Integer] ID of the code scanning analysis
|
75
|
+
#
|
76
|
+
# @return [Sawyer::Resource] Code Scanning Analysis
|
77
|
+
# @see https://docs.github.com/en/rest/code-scanning/code-scanning#get-a-code-scanning-analysis-for-a-repository
|
78
|
+
def get_code_scanning_analysis(repo, analysis_id, options = {})
|
79
|
+
get "#{Repository.path repo}/code-scanning/analyses/#{analysis_id}", options
|
80
|
+
end
|
81
|
+
|
82
|
+
# List code scanning analyses for a repository
|
83
|
+
#
|
84
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
85
|
+
#
|
86
|
+
# @return [Array] List of Code Scanning Analyses
|
87
|
+
# @see https://docs.github.com/en/rest/code-scanning/code-scanning#list-code-scanning-analyses-for-a-repository
|
88
|
+
def list_code_scanning_analysis(repo, options = {})
|
89
|
+
paginate "#{Repository.path repo}/code-scanning/analyses", options
|
90
|
+
end
|
91
|
+
|
92
|
+
# List instances of a code scanning alert
|
93
|
+
#
|
94
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
95
|
+
# @param alert_number [Integer] The number that identifies an alert
|
96
|
+
#
|
97
|
+
# @return [Array] List of Code Scanning Alerts
|
98
|
+
# @see https://docs.github.com/en/rest/code-scanning/code-scanning#list-instances-of-a-code-scanning-alert
|
99
|
+
def list_instances_of_code_scanning_alert(repo, alert_number, options = {})
|
100
|
+
paginate "#{Repository.path repo}/code-scanning/alerts/#{alert_number}/instances", options
|
101
|
+
end
|
102
|
+
|
103
|
+
# Update a code scanning alert
|
104
|
+
#
|
105
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
106
|
+
# @param alert_number [Integer] The number that identifies an alert
|
107
|
+
# @param state [String] The reason for dismissing or closing the alert. Required when the state is dismissed
|
108
|
+
#
|
109
|
+
# @return [Sawyer::Resource] Code Scanning Alert information
|
110
|
+
# @see https://docs.github.com/en/rest/code-scanning/code-scanning#update-a-code-scanning-alert
|
111
|
+
def update_code_scanning_alert(repo, alert_number, state, reason, comment = nil, options = {})
|
112
|
+
options[:state] = state
|
113
|
+
options[:dismissed_reason] = reason
|
114
|
+
options[:dismissed_comment] = comment if comment
|
115
|
+
|
116
|
+
patch "#{Repository.path repo}/code-scanning/alerts/#{alert_number}", options
|
117
|
+
end
|
118
|
+
|
119
|
+
# Gets a single code scanning alert
|
120
|
+
#
|
121
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
122
|
+
# @param alert_number [Integer] The number that identifies an alert
|
123
|
+
#
|
124
|
+
# @return [Sawyer::Resource] Code Scanning Alert
|
125
|
+
# @see https://docs.github.com/en/rest/code-scanning/code-scanning#get-a-code-scanning-alert
|
126
|
+
def get_code_scanning_alert(repo, alert_number, options = {})
|
127
|
+
get "#{Repository.path repo}/code-scanning/alerts/#{alert_number}", options
|
128
|
+
end
|
129
|
+
|
130
|
+
# List code scanning alerts for a repository
|
131
|
+
#
|
132
|
+
# @param org [String] A GitHub organization
|
133
|
+
#
|
134
|
+
# @return [Array] Code Scanning Alert information
|
135
|
+
# @see https://docs.github.com/en/rest/code-scanning/code-scanning#list-code-scanning-alerts-for-a-repository
|
136
|
+
def list_code_scanning_alerts_for_repo(repo, options = {})
|
137
|
+
paginate "#{Repository.path repo}/code-scanning/alerts", options
|
138
|
+
end
|
139
|
+
|
140
|
+
# List code scanning alerts for an organization
|
141
|
+
#
|
142
|
+
# @param org [String] A GitHub organization
|
143
|
+
#
|
144
|
+
# @return [Array] Code Scanning Alert information
|
145
|
+
# @see https://docs.github.com/en/rest/code-scanning/code-scanning#list-code-scanning-alerts-for-an-organization
|
146
|
+
def list_code_scanning_alerts_for_org(org, options = {})
|
147
|
+
paginate "orgs/#{org}/code-scanning/alerts", options
|
148
|
+
end
|
149
|
+
|
12
150
|
# Uploads SARIF data containing the results of a code scanning analysis
|
13
151
|
#
|
14
152
|
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
@@ -197,22 +197,30 @@ module Octokit
|
|
197
197
|
# @param body [String] Comment content
|
198
198
|
# @param commit_id [String] Sha of the commit to comment on.
|
199
199
|
# @param path [String] Relative path of the file to comment on.
|
200
|
-
# @param line [Integer]
|
200
|
+
# @param line [Integer] Optional line index in the diff to comment on.
|
201
201
|
# For a multi-line comment, the last line of the range
|
202
202
|
# and specify 'start_line' in the 'options'.
|
203
|
+
# If not specified, the comment will be on the whole file.
|
203
204
|
# @return [Sawyer::Resource] Hash representing the new comment
|
204
205
|
# @deprecated The position will be deprecated in the next major version. Please refer to the details below.
|
205
206
|
# @see https://developer.github.com/v3/pulls/comments/#create-a-comment
|
206
207
|
# @example
|
207
208
|
# @client.create_pull_request_comment("octokit/octokit.rb", 163, ":shipit:",
|
208
209
|
# "2d3201e4440903d8b04a5487842053ca4883e5f0", "lib/octokit/request.rb", 47)
|
209
|
-
def create_pull_request_comment(repo, pull_id, body, commit_id, path, line, options = {})
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
210
|
+
def create_pull_request_comment(repo, pull_id, body, commit_id, path, line = nil, options = {})
|
211
|
+
comment = {
|
212
|
+
body: body,
|
213
|
+
commit_id: commit_id,
|
214
|
+
path: path
|
215
|
+
}
|
216
|
+
|
217
|
+
if line.nil?
|
218
|
+
comment[:subject_type] = 'file'
|
219
|
+
else
|
220
|
+
comment[:line] = line
|
221
|
+
end
|
222
|
+
|
223
|
+
options.merge! comment
|
216
224
|
post "#{Repository.path repo}/pulls/#{pull_id}/comments", options
|
217
225
|
end
|
218
226
|
alias create_pull_comment create_pull_request_comment
|
@@ -774,6 +774,49 @@ module Octokit
|
|
774
774
|
def disable_vulnerability_alerts(repo, options = {})
|
775
775
|
boolean_from_response(:delete, "#{Repository.path repo}/vulnerability-alerts", options)
|
776
776
|
end
|
777
|
+
|
778
|
+
# Check to see if automated security fixes are enabled for a repository
|
779
|
+
#
|
780
|
+
# The authenticated user must have admin access to the repository.
|
781
|
+
#
|
782
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository.
|
783
|
+
# @return [Boolean] True if automated security fixes are enabled, false otherwise.
|
784
|
+
# @see https://docs.github.com/en/rest/reference/repos#check-if-automated-security-fixes-are-enabled-for-a-repository
|
785
|
+
#
|
786
|
+
# @example
|
787
|
+
# @client.automated_security_fixes_enabled?("octokit/octokit.rb")
|
788
|
+
def automated_security_fixes_enabled?(repo, options = {})
|
789
|
+
response = get "#{Repository.path repo}/automated-security-fixes", options
|
790
|
+
return response[:enabled] if @last_response.status == 200
|
791
|
+
|
792
|
+
false
|
793
|
+
end
|
794
|
+
|
795
|
+
# Enable automated security fixes for a repository
|
796
|
+
#
|
797
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository.
|
798
|
+
# @param options [Hash]
|
799
|
+
#
|
800
|
+
# @return [Boolean] True if vulnerability alerts enabled, false otherwise.
|
801
|
+
# @see https://docs.github.com/en/rest/reference/repos#automated-security-fixes
|
802
|
+
# @example Enable automated security fixes for a repository
|
803
|
+
# @client.enable_automated_security_fixes("octokit/octokit.rb")
|
804
|
+
def enable_automated_security_fixes(repo, options = {})
|
805
|
+
boolean_from_response(:put, "#{Repository.path repo}/automated-security-fixes", options)
|
806
|
+
end
|
807
|
+
|
808
|
+
# Disable automated security fixes for a repository
|
809
|
+
#
|
810
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository.
|
811
|
+
# @param options [Hash]
|
812
|
+
#
|
813
|
+
# @return [Boolean] True if vulnerability alerts disabled, false otherwise.
|
814
|
+
# @see https://docs.github.com/en/rest/reference/repos#automated-security-fixes
|
815
|
+
# @example Disable automated security fixes for a repository
|
816
|
+
# @client.disable_automated_security_fixes("octokit/octokit.rb")
|
817
|
+
def disable_automated_security_fixes(repo, options = {})
|
818
|
+
boolean_from_response(:delete, "#{Repository.path repo}/automated-security-fixes", options)
|
819
|
+
end
|
777
820
|
end
|
778
821
|
end
|
779
822
|
end
|
data/lib/octokit/client.rb
CHANGED
@@ -259,6 +259,7 @@ module Octokit
|
|
259
259
|
conn_opts[:proxy] = @proxy if @proxy
|
260
260
|
conn_opts[:ssl] = { verify_mode: @ssl_verify_mode } if @ssl_verify_mode
|
261
261
|
conn = Faraday.new(conn_opts) do |http|
|
262
|
+
http_cache_middleware = http.builder.handlers.delete(Faraday::HttpCache) if Faraday.const_defined?(:HttpCache)
|
262
263
|
if basic_authenticated?
|
263
264
|
http.request(*FARADAY_BASIC_AUTH_KEYS, @login, @password)
|
264
265
|
elsif token_authenticated?
|
@@ -266,6 +267,7 @@ module Octokit
|
|
266
267
|
elsif bearer_authenticated?
|
267
268
|
http.request :authorization, 'Bearer', @bearer_token
|
268
269
|
end
|
270
|
+
http.builder.handlers.push(http_cache_middleware) unless http_cache_middleware.nil?
|
269
271
|
http.headers['accept'] = options[:accept] if options.key?(:accept)
|
270
272
|
end
|
271
273
|
conn.builder.delete(Octokit::Middleware::FollowRedirects)
|
data/lib/octokit/connection.rb
CHANGED
@@ -106,6 +106,7 @@ module Octokit
|
|
106
106
|
http.headers[:accept] = default_media_type
|
107
107
|
http.headers[:content_type] = 'application/json'
|
108
108
|
http.headers[:user_agent] = user_agent
|
109
|
+
http_cache_middleware = http.builder.handlers.delete(Faraday::HttpCache) if Faraday.const_defined?(:HttpCache)
|
109
110
|
if basic_authenticated?
|
110
111
|
http.request(*FARADAY_BASIC_AUTH_KEYS, @login, @password)
|
111
112
|
elsif token_authenticated?
|
@@ -115,6 +116,7 @@ module Octokit
|
|
115
116
|
elsif application_authenticated?
|
116
117
|
http.request(*FARADAY_BASIC_AUTH_KEYS, @client_id, @client_secret)
|
117
118
|
end
|
119
|
+
http.builder.handlers.push(http_cache_middleware) unless http_cache_middleware.nil?
|
118
120
|
end
|
119
121
|
end
|
120
122
|
|
data/lib/octokit/default.rb
CHANGED
@@ -12,11 +12,6 @@ if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0')
|
|
12
12
|
rescue LoadError
|
13
13
|
Octokit::Warnable.octokit_warn 'To use retry middleware with Faraday v2.0+, install `faraday-retry` gem'
|
14
14
|
end
|
15
|
-
begin
|
16
|
-
require 'faraday/multipart'
|
17
|
-
rescue LoadError
|
18
|
-
Octokit::Warnable.octokit_warn 'To use multipart middleware with Faraday v2.0+, install `faraday-multipart` gem; note: this is used by the ManageGHES client for uploading licenses'
|
19
|
-
end
|
20
15
|
end
|
21
16
|
|
22
17
|
module Octokit
|
@@ -14,7 +14,7 @@ module Octokit
|
|
14
14
|
# @see https://docs.github.com/en/enterprise-server@3.4/rest/enterprise-admin/management-console#create-a-github-license
|
15
15
|
# @return nil
|
16
16
|
def upload_license(license, settings = nil)
|
17
|
-
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.
|
17
|
+
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.')
|
18
18
|
conn = faraday_configuration
|
19
19
|
|
20
20
|
params = {}
|
@@ -29,7 +29,7 @@ module Octokit
|
|
29
29
|
#
|
30
30
|
# @return nil
|
31
31
|
def start_configuration
|
32
|
-
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.
|
32
|
+
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.')
|
33
33
|
post '/setup/api/configure', password_hash
|
34
34
|
end
|
35
35
|
|
@@ -39,7 +39,7 @@ module Octokit
|
|
39
39
|
#
|
40
40
|
# @return nil
|
41
41
|
def upgrade(license)
|
42
|
-
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.
|
42
|
+
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.')
|
43
43
|
conn = faraday_configuration
|
44
44
|
|
45
45
|
params = {}
|
@@ -52,7 +52,7 @@ module Octokit
|
|
52
52
|
#
|
53
53
|
# @return [Sawyer::Resource] The installation information
|
54
54
|
def config_status
|
55
|
-
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.
|
55
|
+
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.')
|
56
56
|
get '/setup/api/configcheck', password_hash
|
57
57
|
end
|
58
58
|
alias config_check config_status
|
@@ -61,7 +61,7 @@ module Octokit
|
|
61
61
|
#
|
62
62
|
# @return [Sawyer::Resource] The settings
|
63
63
|
def settings
|
64
|
-
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.
|
64
|
+
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.')
|
65
65
|
get '/setup/api/settings', password_hash
|
66
66
|
end
|
67
67
|
alias get_settings settings
|
@@ -72,7 +72,7 @@ module Octokit
|
|
72
72
|
#
|
73
73
|
# @return [nil]
|
74
74
|
def edit_settings(settings)
|
75
|
-
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.
|
75
|
+
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.')
|
76
76
|
queries = password_hash
|
77
77
|
queries[:query][:settings] = settings.to_json.to_s
|
78
78
|
put '/setup/api/settings', queries
|
@@ -82,7 +82,7 @@ module Octokit
|
|
82
82
|
#
|
83
83
|
# @return [Sawyer::Resource] The maintenance status
|
84
84
|
def maintenance_status
|
85
|
-
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.
|
85
|
+
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.')
|
86
86
|
get '/setup/api/maintenance', password_hash
|
87
87
|
end
|
88
88
|
alias get_maintenance_status maintenance_status
|
@@ -92,7 +92,7 @@ module Octokit
|
|
92
92
|
# @param maintenance [Hash] A hash configuration of the maintenance settings
|
93
93
|
# @return [nil]
|
94
94
|
def set_maintenance_status(maintenance)
|
95
|
-
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.
|
95
|
+
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.')
|
96
96
|
queries = password_hash
|
97
97
|
queries[:query][:maintenance] = maintenance.to_json.to_s
|
98
98
|
post '/setup/api/maintenance', queries
|
@@ -103,7 +103,7 @@ module Octokit
|
|
103
103
|
#
|
104
104
|
# @return [Sawyer::Resource] An array of authorized SSH keys
|
105
105
|
def authorized_keys
|
106
|
-
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.
|
106
|
+
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.')
|
107
107
|
get '/setup/api/settings/authorized-keys', password_hash
|
108
108
|
end
|
109
109
|
alias get_authorized_keys authorized_keys
|
@@ -113,7 +113,7 @@ module Octokit
|
|
113
113
|
# @param key Either the file path to a key, a File handler to the key, or the contents of the key itself
|
114
114
|
# @return [Sawyer::Resource] An array of authorized SSH keys
|
115
115
|
def add_authorized_key(key)
|
116
|
-
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.
|
116
|
+
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.')
|
117
117
|
queries = password_hash
|
118
118
|
case key
|
119
119
|
when String
|
@@ -138,7 +138,7 @@ module Octokit
|
|
138
138
|
# @param key Either the file path to a key, a File handler to the key, or the contents of the key itself
|
139
139
|
# @return [Sawyer::Resource] An array of authorized SSH keys
|
140
140
|
def remove_authorized_key(key)
|
141
|
-
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.
|
141
|
+
octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.')
|
142
142
|
queries = password_hash
|
143
143
|
case key
|
144
144
|
when String
|
@@ -171,7 +171,14 @@ module Octokit
|
|
171
171
|
def faraday_configuration
|
172
172
|
@faraday_configuration ||= Faraday.new(url: @management_console_endpoint) do |http|
|
173
173
|
http.headers[:user_agent] = user_agent
|
174
|
-
|
174
|
+
begin
|
175
|
+
http.request :multipart
|
176
|
+
rescue Faraday::Error
|
177
|
+
raise Faraday::Error, <<~ERROR
|
178
|
+
The `faraday-multipart` gem is required to upload a license.
|
179
|
+
Please add `gem "faraday-multipart"` to your Gemfile.
|
180
|
+
ERROR
|
181
|
+
end
|
175
182
|
http.request :url_encoded
|
176
183
|
|
177
184
|
# Disabling SSL is essential for certain self-hosted Enterprise instances
|
@@ -36,7 +36,14 @@ module Octokit
|
|
36
36
|
# @return [nil]
|
37
37
|
def upload_license(license)
|
38
38
|
conn = authenticated_client
|
39
|
-
|
39
|
+
begin
|
40
|
+
conn.request :multipart
|
41
|
+
rescue Faraday::Error
|
42
|
+
raise Faraday::Error, <<~ERROR
|
43
|
+
The `faraday-multipart` gem is required to upload a license.
|
44
|
+
Please add `gem "faraday-multipart"` to your Gemfile.
|
45
|
+
ERROR
|
46
|
+
end
|
40
47
|
params = {}
|
41
48
|
params[:license] = Faraday::FilePart.new(license, 'binary')
|
42
49
|
params[:password] = @manage_ghes_password
|
data/lib/octokit/repository.rb
CHANGED
@@ -81,8 +81,14 @@ module Octokit
|
|
81
81
|
|
82
82
|
private
|
83
83
|
|
84
|
+
ABS_URI_REGEXP = if URI.const_defined?(:RFC2396_PARSER) # Ruby 3.4+
|
85
|
+
URI::RFC2396_PARSER.regexp.fetch(:ABS_URI)
|
86
|
+
else
|
87
|
+
URI::RFC2396_Parser.new.regexp.fetch(:ABS_URI)
|
88
|
+
end
|
89
|
+
|
84
90
|
def validate_owner_and_name!(repo)
|
85
|
-
if @owner.include?('/') || @name.include?('/') || !url.match(
|
91
|
+
if @owner.include?('/') || @name.include?('/') || !url.match?(ABS_URI_REGEXP)
|
86
92
|
raise_invalid_repository!(repo)
|
87
93
|
end
|
88
94
|
end
|
data/lib/octokit/version.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octokit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.
|
4
|
+
version: 9.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wynn Netherland
|
8
8
|
- Erik Michaels-Ober
|
9
9
|
- Clint Shryock
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-
|
13
|
+
date: 2024-10-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|
@@ -153,7 +153,7 @@ licenses:
|
|
153
153
|
- MIT
|
154
154
|
metadata:
|
155
155
|
rubygems_mfa_required: 'true'
|
156
|
-
post_install_message:
|
156
|
+
post_install_message:
|
157
157
|
rdoc_options: []
|
158
158
|
require_paths:
|
159
159
|
- lib
|
@@ -168,8 +168,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
168
|
- !ruby/object:Gem::Version
|
169
169
|
version: 1.3.5
|
170
170
|
requirements: []
|
171
|
-
rubygems_version: 3.
|
172
|
-
signing_key:
|
171
|
+
rubygems_version: 3.0.3.1
|
172
|
+
signing_key:
|
173
173
|
specification_version: 4
|
174
174
|
summary: Ruby toolkit for working with the GitHub API
|
175
175
|
test_files: []
|