octokit 4.22.0 → 9.2.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/README.md +117 -95
- data/Rakefile +20 -14
- data/lib/ext/sawyer/relation.rb +4 -2
- data/lib/octokit/arguments.rb +3 -3
- data/lib/octokit/authentication.rb +10 -3
- data/lib/octokit/client/actions_artifacts.rb +71 -0
- data/lib/octokit/client/actions_secrets.rb +111 -8
- data/lib/octokit/client/actions_workflow_jobs.rb +65 -0
- data/lib/octokit/client/actions_workflow_runs.rb +23 -3
- data/lib/octokit/client/actions_workflows.rb +27 -2
- data/lib/octokit/client/apps.rb +63 -26
- data/lib/octokit/client/checks.rb +18 -9
- data/lib/octokit/client/code_scanning.rb +190 -0
- data/lib/octokit/client/codespaces_secrets.rb +108 -0
- data/lib/octokit/client/commit_branches.rb +2 -2
- data/lib/octokit/client/commit_comments.rb +8 -8
- data/lib/octokit/client/commit_pulls.rb +2 -2
- data/lib/octokit/client/commits.rb +25 -33
- data/lib/octokit/client/community_profile.rb +2 -3
- data/lib/octokit/client/contents.rb +19 -22
- data/lib/octokit/client/dependabot_secrets.rb +108 -0
- data/lib/octokit/client/deployments.rb +8 -8
- data/lib/octokit/client/downloads.rb +5 -6
- data/lib/octokit/client/emojis.rb +3 -3
- data/lib/octokit/client/environments.rb +58 -0
- data/lib/octokit/client/events.rb +4 -5
- data/lib/octokit/client/feeds.rb +4 -5
- data/lib/octokit/client/gists.rb +6 -6
- data/lib/octokit/client/gitignore.rb +3 -3
- data/lib/octokit/client/hooks.rb +9 -19
- data/lib/octokit/client/issues.rb +14 -15
- data/lib/octokit/client/labels.rb +10 -10
- data/lib/octokit/client/legacy_search.rb +3 -3
- data/lib/octokit/client/licenses.rb +3 -6
- data/lib/octokit/client/markdown.rb +3 -3
- data/lib/octokit/client/marketplace.rb +4 -4
- data/lib/octokit/client/meta.rb +4 -5
- data/lib/octokit/client/milestones.rb +5 -5
- data/lib/octokit/client/notifications.rb +6 -6
- data/lib/octokit/client/oauth_applications.rb +1 -7
- data/lib/octokit/client/objects.rb +14 -14
- data/lib/octokit/client/organizations.rb +100 -56
- data/lib/octokit/client/pages.rb +5 -7
- data/lib/octokit/client/projects.rb +44 -64
- data/lib/octokit/client/pull_requests.rb +66 -45
- data/lib/octokit/client/rate_limit.rb +9 -11
- data/lib/octokit/client/reactions.rb +62 -16
- data/lib/octokit/client/refs.rb +14 -17
- data/lib/octokit/client/releases.rb +13 -13
- data/lib/octokit/client/repositories.rb +92 -69
- data/lib/octokit/client/repository_invitations.rb +3 -3
- data/lib/octokit/client/reviews.rb +8 -8
- data/lib/octokit/client/say.rb +4 -5
- data/lib/octokit/client/search.rb +24 -10
- data/lib/octokit/client/service_status.rb +19 -9
- data/lib/octokit/client/source_import.rb +7 -12
- data/lib/octokit/client/stats.rb +10 -9
- data/lib/octokit/client/statuses.rb +5 -5
- data/lib/octokit/client/tokens.rb +31 -0
- data/lib/octokit/client/traffic.rb +6 -11
- data/lib/octokit/client/users.rb +54 -33
- data/lib/octokit/client.rb +42 -18
- data/lib/octokit/configurable.rb +51 -31
- data/lib/octokit/connection.rb +30 -21
- data/lib/octokit/default.rb +66 -35
- data/lib/octokit/enterprise_admin_client/admin_stats.rb +13 -14
- data/lib/octokit/enterprise_admin_client/license.rb +3 -4
- data/lib/octokit/enterprise_admin_client/orgs.rb +3 -4
- data/lib/octokit/enterprise_admin_client/search_indexing.rb +7 -8
- data/lib/octokit/enterprise_admin_client/users.rb +5 -4
- data/lib/octokit/enterprise_admin_client.rb +9 -3
- data/lib/octokit/enterprise_management_console_client/management_console.rb +51 -33
- data/lib/octokit/enterprise_management_console_client.rb +8 -2
- data/lib/octokit/error.rb +51 -34
- data/lib/octokit/gist.rb +3 -4
- data/lib/octokit/manage_ghes_client/manage_ghes.rb +178 -0
- data/lib/octokit/manage_ghes_client.rb +64 -0
- data/lib/octokit/middleware/follow_redirects.rb +13 -12
- data/lib/octokit/organization.rb +3 -1
- data/lib/octokit/rate_limit.rb +8 -6
- data/lib/octokit/repo_arguments.rb +3 -4
- data/lib/octokit/repository.rb +32 -25
- data/lib/octokit/response/base_middleware.rb +10 -0
- data/lib/octokit/response/feed_parser.rb +5 -7
- data/lib/octokit/response/raise_error.rb +4 -4
- data/lib/octokit/user.rb +4 -2
- data/lib/octokit/version.rb +4 -2
- data/lib/octokit/warnable.rb +4 -5
- data/lib/octokit.rb +30 -8
- data/octokit.gemspec +12 -11
- metadata +19 -31
- data/lib/octokit/client/authorizations.rb +0 -182
- data/lib/octokit/client/pub_sub_hubbub.rb +0 -111
- data/lib/octokit/preview.rb +0 -46
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Reacions API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/reactions/
|
7
8
|
module Reactions
|
8
|
-
|
9
9
|
# List reactions for a commit comment
|
10
10
|
#
|
11
11
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
@@ -17,7 +17,6 @@ module Octokit
|
|
17
17
|
#
|
18
18
|
# @return [Array<Sawyer::Resource>] Array of Hashes representing the reactions.
|
19
19
|
def commit_comment_reactions(repo, id, options = {})
|
20
|
-
options = ensure_api_media_type(:reactions, options)
|
21
20
|
get "#{Repository.path repo}/comments/#{id}/reactions", options
|
22
21
|
end
|
23
22
|
|
@@ -34,7 +33,7 @@ module Octokit
|
|
34
33
|
#
|
35
34
|
# @return [<Sawyer::Resource>] Hash representing the reaction
|
36
35
|
def create_commit_comment_reaction(repo, id, reaction, options = {})
|
37
|
-
options =
|
36
|
+
options = options.merge(content: reaction)
|
38
37
|
post "#{Repository.path repo}/comments/#{id}/reactions", options
|
39
38
|
end
|
40
39
|
|
@@ -49,7 +48,6 @@ module Octokit
|
|
49
48
|
#
|
50
49
|
# @return [Array<Sawyer::Resource>] Array of Hashes representing the reactions.
|
51
50
|
def issue_reactions(repo, number, options = {})
|
52
|
-
options = ensure_api_media_type(:reactions, options)
|
53
51
|
get "#{Repository.path repo}/issues/#{number}/reactions", options
|
54
52
|
end
|
55
53
|
|
@@ -67,7 +65,7 @@ module Octokit
|
|
67
65
|
#
|
68
66
|
# @return [<Sawyer::Resource>] Hash representing the reaction.
|
69
67
|
def create_issue_reaction(repo, number, reaction, options = {})
|
70
|
-
options =
|
68
|
+
options = options.merge(content: reaction)
|
71
69
|
post "#{Repository.path repo}/issues/#{number}/reactions", options
|
72
70
|
end
|
73
71
|
|
@@ -83,7 +81,6 @@ module Octokit
|
|
83
81
|
#
|
84
82
|
# @return [Array<Sawyer::Resource>] Array of Hashes representing the reactions.
|
85
83
|
def issue_comment_reactions(repo, id, options = {})
|
86
|
-
options = ensure_api_media_type(:reactions, options)
|
87
84
|
get "#{Repository.path repo}/issues/comments/#{id}/reactions", options
|
88
85
|
end
|
89
86
|
|
@@ -101,7 +98,7 @@ module Octokit
|
|
101
98
|
#
|
102
99
|
# @return [<Sawyer::Resource>] Hashes representing the reaction.
|
103
100
|
def create_issue_comment_reaction(repo, id, reaction, options = {})
|
104
|
-
options =
|
101
|
+
options = options.merge(content: reaction)
|
105
102
|
post "#{Repository.path repo}/issues/comments/#{id}/reactions", options
|
106
103
|
end
|
107
104
|
|
@@ -117,7 +114,6 @@ module Octokit
|
|
117
114
|
#
|
118
115
|
# @return [Array<Sawyer::Resource>] Array of Hashes representing the reactions.
|
119
116
|
def pull_request_review_comment_reactions(repo, id, options = {})
|
120
|
-
options = ensure_api_media_type(:reactions, options)
|
121
117
|
get "#{Repository.path repo}/pulls/comments/#{id}/reactions", options
|
122
118
|
end
|
123
119
|
|
@@ -135,23 +131,73 @@ module Octokit
|
|
135
131
|
#
|
136
132
|
# @return [<Sawyer::Resource>] Hash representing the reaction.
|
137
133
|
def create_pull_request_review_comment_reaction(repo, id, reaction, options = {})
|
138
|
-
options =
|
134
|
+
options = options.merge(content: reaction)
|
139
135
|
post "#{Repository.path repo}/pulls/comments/#{id}/reactions", options
|
140
136
|
end
|
141
137
|
|
142
138
|
# Delete a reaction
|
143
139
|
#
|
144
|
-
# @param
|
140
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
141
|
+
# @param issue_id [Integer] The Issue comment id
|
142
|
+
# @param reaction_id [Integer] The Reaction id
|
143
|
+
#
|
144
|
+
# @see https://docs.github.com/en/rest/reactions/reactions#delete-an-issue-reaction
|
145
|
+
#
|
146
|
+
# @example
|
147
|
+
# @client.delete_issue_reaction("octokit/octokit.rb", 1, 2)
|
148
|
+
#
|
149
|
+
# @return [Boolean] Return true if reaction was deleted, false otherwise.
|
150
|
+
def delete_issue_reaction(repo, issue_id, reaction_id, options = {})
|
151
|
+
boolean_from_response :delete, "#{Repository.path repo}/issues/#{issue_id}/reactions/#{reaction_id}", options
|
152
|
+
end
|
153
|
+
|
154
|
+
# List reactions for a release
|
155
|
+
#
|
156
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
157
|
+
# @param id [Integer] The Release id
|
158
|
+
#
|
159
|
+
# @see https://docs.github.com/en/free-pro-team@latest/rest/reactions/reactions?apiVersion=2022-11-28#list-reactions-for-a-release
|
160
|
+
#
|
161
|
+
# @example
|
162
|
+
# @client.release_reactions("octokit/octokit.rb", 1)
|
163
|
+
#
|
164
|
+
# @return [Array<Sawyer::Resource>] Array of Hashes representing the reactions.
|
165
|
+
def release_reactions(repo, release_id, options = {})
|
166
|
+
get "#{Repository.path repo}/releases/#{release_id}/reactions", options
|
167
|
+
end
|
168
|
+
|
169
|
+
# Create reaction for a release
|
170
|
+
#
|
171
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
172
|
+
# @param id [Integer] The Release id
|
173
|
+
# @param reaction [String] The Reaction
|
174
|
+
#
|
175
|
+
# @see https://docs.github.com/en/free-pro-team@latest/rest/reactions/reactions?apiVersion=2022-11-28#create-reaction-for-a-release
|
176
|
+
# @see https://developer.github.com/v3/reactions/#reaction-types
|
177
|
+
#
|
178
|
+
# @example
|
179
|
+
# @client.create_release_reaction("octokit/octokit.rb", 1)
|
180
|
+
#
|
181
|
+
# @return [<Sawyer::Resource>] Hash representing the reaction.
|
182
|
+
def create_release_reaction(repo, release_id, reaction, options = {})
|
183
|
+
options = options.merge(content: reaction)
|
184
|
+
post "#{Repository.path repo}/releases/#{release_id}/reactions", options
|
185
|
+
end
|
186
|
+
|
187
|
+
# Delete a reaction for a release
|
188
|
+
#
|
189
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
190
|
+
# @param issue_id [Integer] The Release id
|
191
|
+
# @param reaction_id [Integer] The Reaction id
|
145
192
|
#
|
146
|
-
# @see https://
|
193
|
+
# @see https://docs.github.com/en/free-pro-team@latest/rest/reactions/reactions?apiVersion=2022-11-28#delete-a-release-reaction
|
147
194
|
#
|
148
195
|
# @example
|
149
|
-
# @client.
|
196
|
+
# @client.delete_release_reaction("octokit/octokit.rb", 1, 2)
|
150
197
|
#
|
151
198
|
# @return [Boolean] Return true if reaction was deleted, false otherwise.
|
152
|
-
def
|
153
|
-
|
154
|
-
boolean_from_response :delete, "reactions/#{id}", options
|
199
|
+
def delete_release_reaction(repo, release_id, reaction_id, options = {})
|
200
|
+
boolean_from_response :delete, "#{Repository.path repo}/releases/#{release_id}/reactions/#{reaction_id}", options
|
155
201
|
end
|
156
202
|
end
|
157
203
|
end
|
data/lib/octokit/client/refs.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for References for Git Data API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/git/refs/
|
7
8
|
module Refs
|
8
|
-
|
9
9
|
# List all refs for a given user and repo
|
10
10
|
#
|
11
11
|
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
@@ -19,9 +19,9 @@ module Octokit
|
|
19
19
|
path += "/#{namespace}" unless namespace.nil?
|
20
20
|
paginate path, options
|
21
21
|
end
|
22
|
-
alias
|
23
|
-
alias
|
24
|
-
alias
|
22
|
+
alias list_refs refs
|
23
|
+
alias references refs
|
24
|
+
alias list_references refs
|
25
25
|
|
26
26
|
# Fetch matching refs
|
27
27
|
#
|
@@ -46,7 +46,7 @@ module Octokit
|
|
46
46
|
def ref(repo, ref, options = {})
|
47
47
|
get "#{Repository.path repo}/git/refs/#{ref}", options
|
48
48
|
end
|
49
|
-
alias
|
49
|
+
alias reference ref
|
50
50
|
|
51
51
|
# Create a reference
|
52
52
|
#
|
@@ -60,12 +60,12 @@ module Octokit
|
|
60
60
|
def create_ref(repo, ref, sha, options = {})
|
61
61
|
ref = "refs/#{ref}" unless ref =~ %r{\Arefs/}
|
62
62
|
parameters = {
|
63
|
-
:
|
64
|
-
:
|
63
|
+
ref: ref,
|
64
|
+
sha: sha
|
65
65
|
}
|
66
66
|
post "#{Repository.path repo}/git/refs", options.merge(parameters)
|
67
67
|
end
|
68
|
-
alias
|
68
|
+
alias create_reference create_ref
|
69
69
|
|
70
70
|
# Update a reference
|
71
71
|
#
|
@@ -77,16 +77,14 @@ module Octokit
|
|
77
77
|
# @see https://developer.github.com/v3/git/refs/#update-a-reference
|
78
78
|
# @example Force update heads/sc/featureA for octocat/Hello-World with sha aa218f56b14c9653891f9e74264a383fa43fefbd
|
79
79
|
# Octokit.update_ref("octocat/Hello-World", "heads/sc/featureA", "aa218f56b14c9653891f9e74264a383fa43fefbd")
|
80
|
-
|
81
|
-
# Octokit.update_ref("octocat/Hello-World", "heads/sc/featureA", "aa218f56b14c9653891f9e74264a383fa43fefbd", false)
|
82
|
-
def update_ref(repo, ref, sha, force = true, options = {})
|
80
|
+
def update_ref(repo, ref, sha, force = false, options = {})
|
83
81
|
parameters = {
|
84
|
-
:
|
85
|
-
:
|
82
|
+
sha: sha,
|
83
|
+
force: force
|
86
84
|
}
|
87
85
|
patch "#{Repository.path repo}/git/refs/#{ref}", options.merge(parameters)
|
88
86
|
end
|
89
|
-
alias
|
87
|
+
alias update_reference update_ref
|
90
88
|
|
91
89
|
# Update a branch
|
92
90
|
#
|
@@ -127,8 +125,7 @@ module Octokit
|
|
127
125
|
def delete_ref(repo, ref, options = {})
|
128
126
|
boolean_from_response :delete, "#{Repository.path repo}/git/refs/#{ref}", options
|
129
127
|
end
|
130
|
-
alias
|
131
|
-
|
128
|
+
alias delete_reference delete_ref
|
132
129
|
end
|
133
130
|
end
|
134
131
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Releases API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/repos/releases/
|
7
8
|
module Releases
|
8
|
-
|
9
9
|
# List releases for a repository
|
10
10
|
#
|
11
11
|
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
@@ -14,7 +14,7 @@ module Octokit
|
|
14
14
|
def releases(repo, options = {})
|
15
15
|
paginate "#{Repository.path repo}/releases", options
|
16
16
|
end
|
17
|
-
alias
|
17
|
+
alias list_releases releases
|
18
18
|
|
19
19
|
# Create a release
|
20
20
|
#
|
@@ -28,7 +28,7 @@ module Octokit
|
|
28
28
|
# @return [Sawyer::Resource] The release
|
29
29
|
# @see https://developer.github.com/v3/repos/releases/#create-a-release
|
30
30
|
def create_release(repo, tag_name, options = {})
|
31
|
-
opts = options.merge(:
|
31
|
+
opts = options.merge(tag_name: tag_name)
|
32
32
|
post "#{Repository.path repo}/releases", opts
|
33
33
|
end
|
34
34
|
|
@@ -55,7 +55,7 @@ module Octokit
|
|
55
55
|
def update_release(url, options = {})
|
56
56
|
patch url, options
|
57
57
|
end
|
58
|
-
alias
|
58
|
+
alias edit_release update_release
|
59
59
|
|
60
60
|
# Delete a release
|
61
61
|
#
|
@@ -84,17 +84,18 @@ module Octokit
|
|
84
84
|
# @return [Sawyer::Resource] The release asset
|
85
85
|
# @see https://developer.github.com/v3/repos/releases/#upload-a-release-asset
|
86
86
|
def upload_asset(release_url, path_or_file, options = {})
|
87
|
-
file = path_or_file.respond_to?(:read) ? path_or_file : File.new(path_or_file,
|
87
|
+
file = path_or_file.respond_to?(:read) ? path_or_file : File.new(path_or_file, 'rb')
|
88
88
|
options[:content_type] ||= content_type_from_file(file)
|
89
|
-
raise Octokit::MissingContentType
|
89
|
+
raise Octokit::MissingContentType if options[:content_type].nil?
|
90
|
+
|
90
91
|
unless name = options[:name]
|
91
92
|
name = File.basename(file.path)
|
92
93
|
end
|
93
|
-
upload_url = release(release_url).rels[:upload].href_template.expand(:
|
94
|
+
upload_url = release(release_url).rels[:upload].href_template.expand(name: name)
|
94
95
|
|
95
96
|
request :post, upload_url, file.read, parse_query_and_convenience_headers(options)
|
96
97
|
ensure
|
97
|
-
file
|
98
|
+
file&.close
|
98
99
|
end
|
99
100
|
|
100
101
|
# Get a single release asset
|
@@ -117,7 +118,7 @@ module Octokit
|
|
117
118
|
def update_release_asset(asset_url, options = {})
|
118
119
|
patch(asset_url, options)
|
119
120
|
end
|
120
|
-
alias
|
121
|
+
alias edit_release_asset update_release_asset
|
121
122
|
|
122
123
|
# Delete a release asset
|
123
124
|
#
|
@@ -155,10 +156,9 @@ module Octokit
|
|
155
156
|
mime_type.content_type
|
156
157
|
end
|
157
158
|
rescue LoadError
|
158
|
-
msg =
|
159
|
-
raise Octokit::MissingContentType
|
159
|
+
msg = 'Please pass content_type or install mime-types gem to guess content type from file'
|
160
|
+
raise Octokit::MissingContentType, msg
|
160
161
|
end
|
161
|
-
|
162
162
|
end
|
163
163
|
end
|
164
164
|
end
|