octokit 4.25.1 → 5.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/lib/octokit/client/actions_workflow_jobs.rb +61 -0
- data/lib/octokit/client/actions_workflow_runs.rb +15 -1
- data/lib/octokit/client/actions_workflows.rb +22 -0
- data/lib/octokit/client/apps.rb +15 -15
- data/lib/octokit/client/community_profile.rb +0 -1
- data/lib/octokit/client/events.rb +0 -1
- data/lib/octokit/client/issues.rb +0 -1
- data/lib/octokit/client/licenses.rb +0 -3
- data/lib/octokit/client/oauth_applications.rb +0 -4
- data/lib/octokit/client/organizations.rb +0 -13
- data/lib/octokit/client/pages.rb +2 -4
- data/lib/octokit/client/projects.rb +25 -44
- data/lib/octokit/client/pub_sub_hubbub.rb +7 -7
- data/lib/octokit/client/reactions.rb +4 -9
- data/lib/octokit/client/repositories.rb +13 -33
- data/lib/octokit/client/reviews.rb +2 -2
- data/lib/octokit/client/search.rb +14 -1
- data/lib/octokit/client/source_import.rb +3 -8
- data/lib/octokit/client/traffic.rb +4 -8
- data/lib/octokit/client/users.rb +0 -7
- data/lib/octokit/client.rb +2 -2
- data/lib/octokit/configurable.rb +2 -4
- data/lib/octokit/connection.rb +1 -1
- data/lib/octokit/default.rb +18 -18
- data/lib/octokit/error.rb +21 -14
- data/lib/octokit/middleware/follow_redirects.rb +1 -1
- data/lib/octokit/rate_limit.rb +1 -1
- data/lib/octokit/repository.rb +1 -0
- data/lib/octokit/version.rb +3 -3
- data/octokit.gemspec +1 -1
- metadata +5 -5
- data/lib/octokit/preview.rb +0 -46
data/lib/octokit/error.rb
CHANGED
@@ -4,6 +4,7 @@ module Octokit
|
|
4
4
|
# Custom error class for rescuing from all GitHub errors
|
5
5
|
class Error < StandardError
|
6
6
|
attr_reader :context
|
7
|
+
|
7
8
|
# Returns the appropriate Octokit::Error subclass based
|
8
9
|
# on status and response message
|
9
10
|
#
|
@@ -57,7 +58,9 @@ module Octokit
|
|
57
58
|
|
58
59
|
# Returns most appropriate error for 401 HTTP status code
|
59
60
|
# @private
|
61
|
+
# rubocop:disable Naming/VariableNumber
|
60
62
|
def self.error_for_401(headers)
|
63
|
+
# rubocop:enbale Naming/VariableNumber
|
61
64
|
if Octokit::OneTimePasswordRequired.required_header(headers)
|
62
65
|
Octokit::OneTimePasswordRequired
|
63
66
|
else
|
@@ -68,27 +71,27 @@ module Octokit
|
|
68
71
|
# Returns most appropriate error for 403 HTTP status code
|
69
72
|
# @private
|
70
73
|
def self.error_for_403(body)
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
+
# rubocop:enable Naming/VariableNumber
|
75
|
+
case body
|
76
|
+
when /rate limit exceeded/i, /exceeded a secondary rate limit/i
|
74
77
|
Octokit::TooManyRequests
|
75
|
-
|
78
|
+
when /login attempts exceeded/i
|
76
79
|
Octokit::TooManyLoginAttempts
|
77
|
-
|
80
|
+
when /returns blobs up to [0-9]+ MB/i
|
78
81
|
Octokit::TooLargeContent
|
79
|
-
|
82
|
+
when /abuse/i
|
80
83
|
Octokit::AbuseDetected
|
81
|
-
|
84
|
+
when /repository access blocked/i
|
82
85
|
Octokit::RepositoryUnavailable
|
83
|
-
|
86
|
+
when /email address must be verified/i
|
84
87
|
Octokit::UnverifiedEmail
|
85
|
-
|
88
|
+
when /account was suspended/i
|
86
89
|
Octokit::AccountSuspended
|
87
|
-
|
90
|
+
when /billing issue/i
|
88
91
|
Octokit::BillingIssue
|
89
|
-
|
92
|
+
when /Resource protected by organization SAML enforcement/i
|
90
93
|
Octokit::SAMLProtected
|
91
|
-
|
94
|
+
when /suspended your access|This installation has been suspended/i
|
92
95
|
Octokit::InstallationSuspended
|
93
96
|
else
|
94
97
|
Octokit::Forbidden
|
@@ -97,7 +100,9 @@ module Octokit
|
|
97
100
|
|
98
101
|
# Return most appropriate error for 404 HTTP status code
|
99
102
|
# @private
|
103
|
+
# rubocop:disable Naming/VariableNumber
|
100
104
|
def self.error_for_404(body)
|
105
|
+
# rubocop:enable Naming/VariableNumber
|
101
106
|
if body =~ /Branch not protected/i
|
102
107
|
Octokit::BranchNotProtected
|
103
108
|
else
|
@@ -107,7 +112,9 @@ module Octokit
|
|
107
112
|
|
108
113
|
# Return most appropriate error for 422 HTTP status code
|
109
114
|
# @private
|
115
|
+
# rubocop:disable Naming/VariableNumber
|
110
116
|
def self.error_for_422(body)
|
117
|
+
# rubocop:enable Naming/VariableNumber
|
111
118
|
if body =~ /PullRequestReviewComment/i && body =~ /(commit_id|end_commit_oid) is not part of the pull request/i
|
112
119
|
Octokit::CommitIsNotPartOfPullRequest
|
113
120
|
elsif body =~ /Path diff too large/i
|
@@ -120,7 +127,7 @@ module Octokit
|
|
120
127
|
# Array of validation errors
|
121
128
|
# @return [Array<Hash>] Error info
|
122
129
|
def errors
|
123
|
-
if data
|
130
|
+
if data.is_a?(Hash)
|
124
131
|
data[:errors] || []
|
125
132
|
else
|
126
133
|
[]
|
@@ -196,7 +203,7 @@ module Octokit
|
|
196
203
|
return nil if @response.nil?
|
197
204
|
|
198
205
|
message = +"#{@response[:method].to_s.upcase} "
|
199
|
-
message << redact_url(@response[:url].to_s.dup)
|
206
|
+
message << "#{redact_url(@response[:url].to_s.dup)}: "
|
200
207
|
message << "#{@response[:status]} - "
|
201
208
|
message << response_message.to_s unless response_message.nil?
|
202
209
|
message << response_error.to_s unless response_error.nil?
|
@@ -127,7 +127,7 @@ module Octokit
|
|
127
127
|
# risk double-escaping.
|
128
128
|
def safe_escape(uri)
|
129
129
|
uri.to_s.gsub(URI_UNSAFE) do |match|
|
130
|
-
|
130
|
+
"%#{match.unpack('H2' * match.bytesize).join('%').upcase}"
|
131
131
|
end
|
132
132
|
end
|
133
133
|
end
|
data/lib/octokit/rate_limit.rb
CHANGED
@@ -20,7 +20,7 @@ module Octokit
|
|
20
20
|
# @return [RateLimit]
|
21
21
|
def self.from_response(response)
|
22
22
|
info = new
|
23
|
-
if response
|
23
|
+
if response.respond_to?(:headers) && !response.headers.nil?
|
24
24
|
info.limit = (response.headers['X-RateLimit-Limit'] || 1).to_i
|
25
25
|
info.remaining = (response.headers['X-RateLimit-Remaining'] || 1).to_i
|
26
26
|
info.resets_at = Time.at((response.headers['X-RateLimit-Reset'] || Time.now).to_i)
|
data/lib/octokit/repository.rb
CHANGED
data/lib/octokit/version.rb
CHANGED
@@ -3,15 +3,15 @@
|
|
3
3
|
module Octokit
|
4
4
|
# Current major release.
|
5
5
|
# @return [Integer]
|
6
|
-
MAJOR =
|
6
|
+
MAJOR = 5
|
7
7
|
|
8
8
|
# Current minor release.
|
9
9
|
# @return [Integer]
|
10
|
-
MINOR =
|
10
|
+
MINOR = 2
|
11
11
|
|
12
12
|
# Current patch level.
|
13
13
|
# @return [Integer]
|
14
|
-
PATCH =
|
14
|
+
PATCH = 0
|
15
15
|
|
16
16
|
# Full release version.
|
17
17
|
# @return [String]
|
data/octokit.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.licenses = ['MIT']
|
18
18
|
spec.name = 'octokit'
|
19
19
|
spec.require_paths = ['lib']
|
20
|
-
spec.required_ruby_version = '>= 2.
|
20
|
+
spec.required_ruby_version = '>= 2.7.0'
|
21
21
|
spec.required_rubygems_version = '>= 1.3.5'
|
22
22
|
spec.summary = 'Ruby toolkit for working with the GitHub API'
|
23
23
|
spec.version = Octokit::VERSION.dup
|
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
|
+
version: 5.2.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: 2022-
|
13
|
+
date: 2022-08-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- lib/octokit/authentication.rb
|
87
87
|
- lib/octokit/client.rb
|
88
88
|
- lib/octokit/client/actions_secrets.rb
|
89
|
+
- lib/octokit/client/actions_workflow_jobs.rb
|
89
90
|
- lib/octokit/client/actions_workflow_runs.rb
|
90
91
|
- lib/octokit/client/actions_workflows.rb
|
91
92
|
- lib/octokit/client/apps.rb
|
@@ -151,7 +152,6 @@ files:
|
|
151
152
|
- lib/octokit/gist.rb
|
152
153
|
- lib/octokit/middleware/follow_redirects.rb
|
153
154
|
- lib/octokit/organization.rb
|
154
|
-
- lib/octokit/preview.rb
|
155
155
|
- lib/octokit/rate_limit.rb
|
156
156
|
- lib/octokit/repo_arguments.rb
|
157
157
|
- lib/octokit/repository.rb
|
@@ -175,14 +175,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
175
175
|
requirements:
|
176
176
|
- - ">="
|
177
177
|
- !ruby/object:Gem::Version
|
178
|
-
version: 2.
|
178
|
+
version: 2.7.0
|
179
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
180
|
requirements:
|
181
181
|
- - ">="
|
182
182
|
- !ruby/object:Gem::Version
|
183
183
|
version: 1.3.5
|
184
184
|
requirements: []
|
185
|
-
rubygems_version: 3.
|
185
|
+
rubygems_version: 3.1.2
|
186
186
|
signing_key:
|
187
187
|
specification_version: 4
|
188
188
|
summary: Ruby toolkit for working with the GitHub API
|
data/lib/octokit/preview.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Octokit
|
4
|
-
# Default setup options for preview features
|
5
|
-
module Preview
|
6
|
-
PREVIEW_TYPES = {
|
7
|
-
applications_api: 'application/vnd.github.doctor-strange-preview+json',
|
8
|
-
branch_protection: 'application/vnd.github.luke-cage-preview+json',
|
9
|
-
commit_search: 'application/vnd.github.cloak-preview+json',
|
10
|
-
commit_pulls: 'application/vnd.github.groot-preview+json',
|
11
|
-
commit_branches: 'application/vnd.github.groot-preview+json',
|
12
|
-
migrations: 'application/vnd.github.wyandotte-preview+json',
|
13
|
-
licenses: 'application/vnd.github.drax-preview+json',
|
14
|
-
source_imports: 'application/vnd.github.barred-rock-preview',
|
15
|
-
reactions: 'application/vnd.github.squirrel-girl-preview',
|
16
|
-
transfer_repository: 'application/vnd.github.nightshade-preview+json',
|
17
|
-
issue_timelines: 'application/vnd.github.mockingbird-preview+json',
|
18
|
-
nested_teams: 'application/vnd.github.hellcat-preview+json',
|
19
|
-
pages: 'application/vnd.github.mister-fantastic-preview+json',
|
20
|
-
projects: 'application/vnd.github.inertia-preview+json',
|
21
|
-
traffic: 'application/vnd.github.spiderman-preview',
|
22
|
-
topics: 'application/vnd.github.mercy-preview+json',
|
23
|
-
community_profile: 'application/vnd.github.black-panther-preview+json',
|
24
|
-
strict_validation: 'application/vnd.github.speedy-preview+json',
|
25
|
-
template_repositories: 'application/vnd.github.baptiste-preview+json',
|
26
|
-
project_card_events: 'application/vnd.github.starfox-preview+json',
|
27
|
-
vulnerability_alerts: 'application/vnd.github.dorian-preview+json'
|
28
|
-
}.freeze
|
29
|
-
|
30
|
-
def ensure_api_media_type(type, options)
|
31
|
-
if options[:accept].nil?
|
32
|
-
options[:accept] = PREVIEW_TYPES[type]
|
33
|
-
warn_preview(type)
|
34
|
-
end
|
35
|
-
options
|
36
|
-
end
|
37
|
-
|
38
|
-
def warn_preview(type)
|
39
|
-
octokit_warn <<~EOS
|
40
|
-
WARNING: The preview version of the #{type.to_s.capitalize} API is not yet suitable for production use.
|
41
|
-
You can avoid this message by supplying an appropriate media type in the 'Accept' request
|
42
|
-
header.
|
43
|
-
EOS
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|