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,23 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for Projects API
|
5
6
|
#
|
6
|
-
# @see https://
|
7
|
+
# @see https://docs.github.com/en/rest/projects
|
7
8
|
module Projects
|
8
|
-
|
9
9
|
# List projects for a repository
|
10
10
|
#
|
11
11
|
# Requires authenticated client
|
12
12
|
#
|
13
13
|
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
14
14
|
# @return [Array<Sawyer::Resource>] Repository projects
|
15
|
-
# @see https://developer.github.com/v3/projects/#list-repository-projects
|
15
|
+
# @see https://developer.github.com/v3/projects/#list-repository-projects
|
16
16
|
# @example
|
17
17
|
# @client.projects('octokit/octokit.rb')
|
18
18
|
def projects(repo, options = {})
|
19
|
-
|
20
|
-
paginate "#{Repository.path repo}/projects", opts
|
19
|
+
paginate "#{Repository.path repo}/projects", options
|
21
20
|
end
|
22
21
|
|
23
22
|
# Create a project
|
@@ -28,16 +27,15 @@ module Octokit
|
|
28
27
|
# @param name [String] Project name
|
29
28
|
# @option options [String] :body Body of the project
|
30
29
|
# @return [Sawyer::Resource] Fresh new project
|
31
|
-
# @see https://developer.github.com/v3/projects/#create-a-repository-project
|
30
|
+
# @see https://developer.github.com/v3/projects/#create-a-repository-project
|
32
31
|
# @example Create project with only a name
|
33
32
|
# @client.create_project('octokit/octokit.rb', 'implement new APIs')
|
34
33
|
#
|
35
34
|
# @example Create project with name and body
|
36
35
|
# @client.create_project('octokit/octokit.rb', 'bugs be gone', body: 'Fix all the bugs @joeyw creates')
|
37
36
|
def create_project(repo, name, options = {})
|
38
|
-
|
39
|
-
|
40
|
-
post "#{Repository.path repo}/projects", opts
|
37
|
+
options[:name] = name
|
38
|
+
post "#{Repository.path repo}/projects", options
|
41
39
|
end
|
42
40
|
|
43
41
|
# List organization projects
|
@@ -50,10 +48,9 @@ module Octokit
|
|
50
48
|
# @example
|
51
49
|
# @client.org_projects("octokit")
|
52
50
|
def org_projects(org, options = {})
|
53
|
-
|
54
|
-
paginate "orgs/#{org}/projects", opts
|
51
|
+
paginate "orgs/#{org}/projects", options
|
55
52
|
end
|
56
|
-
alias
|
53
|
+
alias organization_projects org_projects
|
57
54
|
|
58
55
|
# Create organization project
|
59
56
|
#
|
@@ -69,22 +66,20 @@ module Octokit
|
|
69
66
|
# @example Create a project with name and body
|
70
67
|
# @client.create_org_project("octokit", "octocan", body: 'Improve clients')
|
71
68
|
def create_org_project(org, name, options = {})
|
72
|
-
|
73
|
-
|
74
|
-
post "orgs/#{org}/projects", opts
|
69
|
+
options[:name] = name
|
70
|
+
post "orgs/#{org}/projects", options
|
75
71
|
end
|
76
|
-
alias
|
72
|
+
alias create_organization_project create_org_project
|
77
73
|
|
78
|
-
# Get a project by id
|
74
|
+
# Get a project by id
|
79
75
|
#
|
80
76
|
# @param id [Integer] Project id
|
81
77
|
# @return [Sawyer::Resource] Project
|
82
|
-
# @see https://developer.github.com/v3/projects/#get-a-project
|
78
|
+
# @see https://developer.github.com/v3/projects/#get-a-project
|
83
79
|
# @example
|
84
80
|
# Octokit.project(123942)
|
85
81
|
def project(id, options = {})
|
86
|
-
|
87
|
-
get "projects/#{id}", opts
|
82
|
+
get "projects/#{id}", options
|
88
83
|
end
|
89
84
|
|
90
85
|
# Update a project
|
@@ -95,12 +90,11 @@ module Octokit
|
|
95
90
|
# @option options [String] :name Project name
|
96
91
|
# @option options [String] :body Project body
|
97
92
|
# @return [Sawyer::Resource] Project
|
98
|
-
# @see https://developer.github.com/v3/projects/#update-a-project
|
93
|
+
# @see https://developer.github.com/v3/projects/#update-a-project
|
99
94
|
# @example Update project name
|
100
95
|
# @client.update_project(123942, name: 'New name')
|
101
96
|
def update_project(id, options = {})
|
102
|
-
|
103
|
-
patch "projects/#{id}", opts
|
97
|
+
patch "projects/#{id}", options
|
104
98
|
end
|
105
99
|
|
106
100
|
# Delete a project
|
@@ -109,24 +103,22 @@ module Octokit
|
|
109
103
|
#
|
110
104
|
# @param id [Integer] Project id
|
111
105
|
# @return [Boolean] Result of deletion
|
112
|
-
# @see https://developer.github.com/v3/projects/#delete-a-project
|
106
|
+
# @see https://developer.github.com/v3/projects/#delete-a-project
|
113
107
|
# @example
|
114
108
|
# @client.delete_project(123942)
|
115
109
|
def delete_project(id, options = {})
|
116
|
-
|
117
|
-
boolean_from_response :delete, "projects/#{id}", opts
|
110
|
+
boolean_from_response :delete, "projects/#{id}", options
|
118
111
|
end
|
119
112
|
|
120
113
|
# List project columns
|
121
114
|
#
|
122
|
-
# @param id [Integer] Project id
|
115
|
+
# @param id [Integer] Project id
|
123
116
|
# @return [Array<Sawyer::Resource>] List of project columns
|
124
|
-
# @see https://developer.github.com/v3/projects/columns/#list-project-columns
|
117
|
+
# @see https://developer.github.com/v3/projects/columns/#list-project-columns
|
125
118
|
# @example
|
126
119
|
# @client.project_columns(123942)
|
127
120
|
def project_columns(id, options = {})
|
128
|
-
|
129
|
-
paginate "projects/#{id}/columns", opts
|
121
|
+
paginate "projects/#{id}/columns", options
|
130
122
|
end
|
131
123
|
|
132
124
|
# Create a project column
|
@@ -136,25 +128,23 @@ module Octokit
|
|
136
128
|
# @param id [Integer] Project column id
|
137
129
|
# @param name [String] New column name
|
138
130
|
# @return [Sawyer::Resource] Newly created column
|
139
|
-
# @see https://developer.github.com/v3/projects/columns/#create-a-project-column
|
131
|
+
# @see https://developer.github.com/v3/projects/columns/#create-a-project-column
|
140
132
|
# @example
|
141
133
|
# @client.create_project_column(123942, "To Dones")
|
142
134
|
def create_project_column(id, name, options = {})
|
143
|
-
|
144
|
-
|
145
|
-
post "projects/#{id}/columns", opts
|
135
|
+
options[:name] = name
|
136
|
+
post "projects/#{id}/columns", options
|
146
137
|
end
|
147
138
|
|
148
139
|
# Get a project column by ID
|
149
140
|
#
|
150
141
|
# @param id [Integer] Project column id
|
151
142
|
# @return [Sawyer::Resource] Project column
|
152
|
-
# @see https://developer.github.com/v3/projects/columns/#get-a-project-column
|
143
|
+
# @see https://developer.github.com/v3/projects/columns/#get-a-project-column
|
153
144
|
# @example
|
154
145
|
# Octokit.project_column(30294)
|
155
146
|
def project_column(id, options = {})
|
156
|
-
|
157
|
-
get "projects/columns/#{id}", opts
|
147
|
+
get "projects/columns/#{id}", options
|
158
148
|
end
|
159
149
|
|
160
150
|
# Update a project column
|
@@ -164,13 +154,12 @@ module Octokit
|
|
164
154
|
# @param id [Integer] Project column id
|
165
155
|
# @param name [String] New column name
|
166
156
|
# @return [Sawyer::Resource] Updated column
|
167
|
-
# @see https://developer.github.com/v3/projects/columns/#update-a-project-column
|
157
|
+
# @see https://developer.github.com/v3/projects/columns/#update-a-project-column
|
168
158
|
# @example
|
169
159
|
# @client.update_project_column(30294, "new column name")
|
170
160
|
def update_project_column(id, name, options = {})
|
171
|
-
|
172
|
-
|
173
|
-
patch "projects/columns/#{id}", opts
|
161
|
+
options[:name] = name
|
162
|
+
patch "projects/columns/#{id}", options
|
174
163
|
end
|
175
164
|
|
176
165
|
# Delete a project column
|
@@ -179,12 +168,11 @@ module Octokit
|
|
179
168
|
#
|
180
169
|
# @param id [Integer] Project column id
|
181
170
|
# @return [Boolean] Result of deletion request, true when deleted
|
182
|
-
# @see https://developer.github.com/v3/projects/columns/#delete-a-project-column
|
171
|
+
# @see https://developer.github.com/v3/projects/columns/#delete-a-project-column
|
183
172
|
# @example
|
184
173
|
# @client.delete_project_column(30294)
|
185
174
|
def delete_project_column(id, options = {})
|
186
|
-
|
187
|
-
boolean_from_response :delete, "projects/columns/#{id}", opts
|
175
|
+
boolean_from_response :delete, "projects/columns/#{id}", options
|
188
176
|
end
|
189
177
|
|
190
178
|
# Move a project column
|
@@ -192,7 +180,7 @@ module Octokit
|
|
192
180
|
# Requires authenticated client
|
193
181
|
#
|
194
182
|
# @param id [Integer] Project column id
|
195
|
-
# @param position [String] New position for the column. Can be one of
|
183
|
+
# @param position [String] New position for the column. Can be one of
|
196
184
|
# <tt>first</tt>, <tt>last</tt>, or <tt>after:<column-id></tt>, where
|
197
185
|
# <tt><column-id></tt> is the id value of a column in the same project.
|
198
186
|
# @return [Sawyer::Resource] Result
|
@@ -200,9 +188,8 @@ module Octokit
|
|
200
188
|
# @example
|
201
189
|
# @client.move_project_column(30294, "last")
|
202
190
|
def move_project_column(id, position, options = {})
|
203
|
-
|
204
|
-
|
205
|
-
post "projects/columns/#{id}/moves", opts
|
191
|
+
options[:position] = position
|
192
|
+
post "projects/columns/#{id}/moves", options
|
206
193
|
end
|
207
194
|
|
208
195
|
# List columns cards
|
@@ -215,8 +202,7 @@ module Octokit
|
|
215
202
|
# @example
|
216
203
|
# @client.column_cards(30294)
|
217
204
|
def column_cards(id, options = {})
|
218
|
-
|
219
|
-
paginate "projects/columns/#{id}/cards", opts
|
205
|
+
paginate "projects/columns/#{id}/cards", options
|
220
206
|
end
|
221
207
|
|
222
208
|
# Create project card
|
@@ -238,8 +224,7 @@ module Octokit
|
|
238
224
|
# @example Create a project card for an repository issue
|
239
225
|
# @client.create_project_card(123495, content_id: 1, content_type: 'Issue')
|
240
226
|
def create_project_card(id, options = {})
|
241
|
-
|
242
|
-
post "projects/columns/#{id}/cards", opts
|
227
|
+
post "projects/columns/#{id}/cards", options
|
243
228
|
end
|
244
229
|
|
245
230
|
# Get a project card
|
@@ -252,8 +237,7 @@ module Octokit
|
|
252
237
|
# @example
|
253
238
|
# @client.project_card(123495)
|
254
239
|
def project_card(id, options = {})
|
255
|
-
|
256
|
-
get "projects/columns/cards/#{id}", opts
|
240
|
+
get "projects/columns/cards/#{id}", options
|
257
241
|
end
|
258
242
|
|
259
243
|
# Update a project card
|
@@ -269,8 +253,7 @@ module Octokit
|
|
269
253
|
# @example
|
270
254
|
# @client.update_project_card(12345, note: 'new note')
|
271
255
|
def update_project_card(id, options = {})
|
272
|
-
|
273
|
-
patch "projects/columns/cards/#{id}", opts
|
256
|
+
patch "projects/columns/cards/#{id}", options
|
274
257
|
end
|
275
258
|
|
276
259
|
# Move a project card
|
@@ -290,13 +273,12 @@ module Octokit
|
|
290
273
|
# @example Move a card to the top of another column
|
291
274
|
# @client.move_project_card(123495, 'top', column_id: 59402)
|
292
275
|
def move_project_card(id, position, options = {})
|
293
|
-
|
294
|
-
|
295
|
-
post "projects/columns/cards/#{id}/moves", opts
|
276
|
+
options[:position] = position
|
277
|
+
post "projects/columns/cards/#{id}/moves", options
|
296
278
|
end
|
297
279
|
|
298
280
|
# Delete a project card
|
299
|
-
#
|
281
|
+
#
|
300
282
|
# Requires authenticated client
|
301
283
|
#
|
302
284
|
# @param id [Integer] Project card id
|
@@ -305,10 +287,8 @@ module Octokit
|
|
305
287
|
# @example
|
306
288
|
# @client.delete_project_card(123495)
|
307
289
|
def delete_project_card(id, options = {})
|
308
|
-
|
309
|
-
boolean_from_response :delete, "projects/columns/cards/#{id}", opts
|
290
|
+
boolean_from_response :delete, "projects/columns/cards/#{id}", options
|
310
291
|
end
|
311
|
-
|
312
292
|
end # Projects
|
313
293
|
end
|
314
294
|
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 Pull Requests API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/pulls/
|
7
8
|
module PullRequests
|
8
|
-
|
9
9
|
# List pull requests for a repository
|
10
10
|
#
|
11
11
|
# @overload pull_requests(repo, options)
|
@@ -19,7 +19,7 @@ module Octokit
|
|
19
19
|
def pull_requests(repo, options = {})
|
20
20
|
paginate "#{Repository.path repo}/pulls", options
|
21
21
|
end
|
22
|
-
alias
|
22
|
+
alias pulls pull_requests
|
23
23
|
|
24
24
|
# Get a pull request
|
25
25
|
#
|
@@ -28,11 +28,11 @@ module Octokit
|
|
28
28
|
# @param number [Integer] Number of the pull request to fetch
|
29
29
|
# @return [Sawyer::Resource] Pull request info
|
30
30
|
# @example
|
31
|
-
# Octokit.pull_request('rails/rails', 42, :state => 'closed')
|
31
|
+
# Octokit.pull_request('rails/rails', 42, :state => 'closed')
|
32
32
|
def pull_request(repo, number, options = {})
|
33
33
|
get "#{Repository.path repo}/pulls/#{number}", options
|
34
34
|
end
|
35
|
-
alias
|
35
|
+
alias pull pull_request
|
36
36
|
|
37
37
|
# Create a pull request
|
38
38
|
#
|
@@ -51,9 +51,9 @@ module Octokit
|
|
51
51
|
# "Pull Request title", "Pull Request body")
|
52
52
|
def create_pull_request(repo, base, head, title, body = nil, options = {})
|
53
53
|
pull = {
|
54
|
-
:
|
55
|
-
:
|
56
|
-
:
|
54
|
+
base: base,
|
55
|
+
head: head,
|
56
|
+
title: title
|
57
57
|
}
|
58
58
|
pull[:body] = body unless body.nil?
|
59
59
|
post "#{Repository.path repo}/pulls", options.merge(pull)
|
@@ -72,9 +72,9 @@ module Octokit
|
|
72
72
|
# @return [Sawyer::Resource] The newly created pull request
|
73
73
|
def create_pull_request_for_issue(repo, base, head, issue, options = {})
|
74
74
|
pull = {
|
75
|
-
:
|
76
|
-
:
|
77
|
-
:
|
75
|
+
base: base,
|
76
|
+
head: head,
|
77
|
+
issue: issue
|
78
78
|
}
|
79
79
|
post "#{Repository.path repo}/pulls", options.merge(pull)
|
80
80
|
end
|
@@ -103,7 +103,7 @@ module Octokit
|
|
103
103
|
# @client.update_pull_request('octokit/octokit.rb', 67, nil, '')
|
104
104
|
def update_pull_request(*args)
|
105
105
|
arguments = Octokit::Arguments.new(args)
|
106
|
-
repo
|
106
|
+
repo = arguments.shift
|
107
107
|
number = arguments.shift
|
108
108
|
patch "#{Repository.path repo}/pulls/#{number}", arguments.options
|
109
109
|
end
|
@@ -117,7 +117,7 @@ module Octokit
|
|
117
117
|
# @example
|
118
118
|
# @client.close_pull_request('octokit/octokit.rb', 67)
|
119
119
|
def close_pull_request(repo, number, options = {})
|
120
|
-
options.merge! :
|
120
|
+
options.merge! state: 'closed'
|
121
121
|
update_pull_request(repo, number, options)
|
122
122
|
end
|
123
123
|
|
@@ -130,7 +130,7 @@ module Octokit
|
|
130
130
|
def pull_request_commits(repo, number, options = {})
|
131
131
|
paginate "#{Repository.path repo}/pulls/#{number}/commits", options
|
132
132
|
end
|
133
|
-
alias
|
133
|
+
alias pull_commits pull_request_commits
|
134
134
|
|
135
135
|
# List pull request comments for a repository
|
136
136
|
#
|
@@ -160,8 +160,8 @@ module Octokit
|
|
160
160
|
def pull_requests_comments(repo, options = {})
|
161
161
|
paginate("#{Repository.path repo}/pulls/comments", options)
|
162
162
|
end
|
163
|
-
alias
|
164
|
-
alias
|
163
|
+
alias pulls_comments pull_requests_comments
|
164
|
+
alias reviews_comments pull_requests_comments
|
165
165
|
|
166
166
|
# List comments on a pull request
|
167
167
|
#
|
@@ -173,8 +173,8 @@ module Octokit
|
|
173
173
|
# return the comments for a pull request
|
174
174
|
paginate("#{Repository.path repo}/pulls/#{number}/comments", options)
|
175
175
|
end
|
176
|
-
alias
|
177
|
-
alias
|
176
|
+
alias pull_comments pull_request_comments
|
177
|
+
alias review_comments pull_request_comments
|
178
178
|
|
179
179
|
# Get a pull request comment
|
180
180
|
#
|
@@ -187,8 +187,8 @@ module Octokit
|
|
187
187
|
def pull_request_comment(repo, comment_id, options = {})
|
188
188
|
get "#{Repository.path repo}/pulls/comments/#{comment_id}", options
|
189
189
|
end
|
190
|
-
alias
|
191
|
-
alias
|
190
|
+
alias pull_comment pull_request_comment
|
191
|
+
alias review_comment pull_request_comment
|
192
192
|
|
193
193
|
# Create a pull request comment
|
194
194
|
#
|
@@ -197,23 +197,34 @@ 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
|
200
|
+
# @param line [Integer] Optional line index in the diff to comment on.
|
201
|
+
# For a multi-line comment, the last line of the range
|
202
|
+
# and specify 'start_line' in the 'options'.
|
203
|
+
# If not specified, the comment will be on the whole file.
|
201
204
|
# @return [Sawyer::Resource] Hash representing the new comment
|
205
|
+
# @deprecated The position will be deprecated in the next major version. Please refer to the details below.
|
202
206
|
# @see https://developer.github.com/v3/pulls/comments/#create-a-comment
|
203
207
|
# @example
|
204
208
|
# @client.create_pull_request_comment("octokit/octokit.rb", 163, ":shipit:",
|
205
209
|
# "2d3201e4440903d8b04a5487842053ca4883e5f0", "lib/octokit/request.rb", 47)
|
206
|
-
def create_pull_request_comment(repo, pull_id, body, commit_id, path,
|
207
|
-
|
208
|
-
:
|
209
|
-
:
|
210
|
-
:
|
211
|
-
|
212
|
-
|
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
|
213
224
|
post "#{Repository.path repo}/pulls/#{pull_id}/comments", options
|
214
225
|
end
|
215
|
-
alias
|
216
|
-
alias
|
226
|
+
alias create_pull_comment create_pull_request_comment
|
227
|
+
alias create_view_comment create_pull_request_comment
|
217
228
|
|
218
229
|
# Create reply to a pull request comment
|
219
230
|
#
|
@@ -227,13 +238,13 @@ module Octokit
|
|
227
238
|
# @client.create_pull_request_comment_reply("octokit/octokit.rb", 163, "done.", 1903950)
|
228
239
|
def create_pull_request_comment_reply(repo, pull_id, body, comment_id, options = {})
|
229
240
|
options.merge!({
|
230
|
-
|
231
|
-
|
232
|
-
|
241
|
+
body: body,
|
242
|
+
in_reply_to: comment_id
|
243
|
+
})
|
233
244
|
post "#{Repository.path repo}/pulls/#{pull_id}/comments", options
|
234
245
|
end
|
235
|
-
alias
|
236
|
-
alias
|
246
|
+
alias create_pull_reply create_pull_request_comment_reply
|
247
|
+
alias create_review_reply create_pull_request_comment_reply
|
237
248
|
|
238
249
|
# Update pull request comment
|
239
250
|
#
|
@@ -245,11 +256,11 @@ module Octokit
|
|
245
256
|
# @example
|
246
257
|
# @client.update_pull_request_comment("octokit/octokit.rb", 1903950, ":shipit:")
|
247
258
|
def update_pull_request_comment(repo, comment_id, body, options = {})
|
248
|
-
options.merge! :
|
259
|
+
options.merge! body: body
|
249
260
|
patch("#{Repository.path repo}/pulls/comments/#{comment_id}", options)
|
250
261
|
end
|
251
|
-
alias
|
252
|
-
alias
|
262
|
+
alias update_pull_comment update_pull_request_comment
|
263
|
+
alias update_review_comment update_pull_request_comment
|
253
264
|
|
254
265
|
# Delete pull request comment
|
255
266
|
#
|
@@ -262,8 +273,8 @@ module Octokit
|
|
262
273
|
def delete_pull_request_comment(repo, comment_id, options = {})
|
263
274
|
boolean_from_response(:delete, "#{Repository.path repo}/pulls/comments/#{comment_id}", options)
|
264
275
|
end
|
265
|
-
alias
|
266
|
-
alias
|
276
|
+
alias delete_pull_comment delete_pull_request_comment
|
277
|
+
alias delete_review_comment delete_pull_request_comment
|
267
278
|
|
268
279
|
# List files on a pull request
|
269
280
|
#
|
@@ -274,7 +285,18 @@ module Octokit
|
|
274
285
|
def pull_request_files(repo, number, options = {})
|
275
286
|
paginate "#{Repository.path repo}/pulls/#{number}/files", options
|
276
287
|
end
|
277
|
-
alias
|
288
|
+
alias pull_files pull_request_files
|
289
|
+
|
290
|
+
# Update a pull request branch
|
291
|
+
#
|
292
|
+
# @see https://developer.github.com/v3/pulls/#update-a-pull-request-branch
|
293
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
294
|
+
# @param number [Integer] Number of pull request
|
295
|
+
# @param options [Hash] Optional parameters (e.g. expected_head_sha)
|
296
|
+
# @return [Boolean] True if the pull request branch has been updated
|
297
|
+
def update_pull_request_branch(repo, number, options = {})
|
298
|
+
boolean_from_response(:put, "#{Repository.path repo}/pulls/#{number}/update-branch", options)
|
299
|
+
end
|
278
300
|
|
279
301
|
# Merge a pull request
|
280
302
|
#
|
@@ -283,8 +305,8 @@ module Octokit
|
|
283
305
|
# @param number [Integer] Number of pull request
|
284
306
|
# @param commit_message [String] Optional commit message for the merge commit
|
285
307
|
# @return [Array<Sawyer::Resource>] Merge commit info if successful
|
286
|
-
def merge_pull_request(repo, number, commit_message='', options = {})
|
287
|
-
put "#{Repository.path repo}/pulls/#{number}/merge", options.merge({:commit_message
|
308
|
+
def merge_pull_request(repo, number, commit_message = '', options = {})
|
309
|
+
put "#{Repository.path repo}/pulls/#{number}/merge", options.merge({ commit_message: commit_message })
|
288
310
|
end
|
289
311
|
|
290
312
|
# Check pull request merge status
|
@@ -296,8 +318,7 @@ module Octokit
|
|
296
318
|
def pull_merged?(repo, number, options = {})
|
297
319
|
boolean_from_response :get, "#{Repository.path repo}/pulls/#{number}/merge", options
|
298
320
|
end
|
299
|
-
alias
|
300
|
-
|
321
|
+
alias pull_request_merged? pull_merged?
|
301
322
|
end
|
302
323
|
end
|
303
324
|
end
|
@@ -1,17 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for API rate limiting info
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/#rate-limiting
|
7
8
|
module RateLimit
|
8
|
-
|
9
9
|
# Get rate limit info from last response if available
|
10
10
|
# or make a new request to fetch rate limit
|
11
11
|
#
|
12
12
|
# @see https://developer.github.com/v3/rate_limit/#rate-limit
|
13
13
|
# @return [Octokit::RateLimit] Rate limit info
|
14
|
-
def rate_limit(
|
14
|
+
def rate_limit(_options = {})
|
15
15
|
return rate_limit! if last_response.nil?
|
16
16
|
|
17
17
|
Octokit::RateLimit.from_response(last_response)
|
@@ -22,8 +22,8 @@ module Octokit
|
|
22
22
|
#
|
23
23
|
# @see https://developer.github.com/v3/rate_limit/#rate-limit
|
24
24
|
# @return [Integer] Number of requests remaining in this period
|
25
|
-
def rate_limit_remaining(
|
26
|
-
octokit_warn
|
25
|
+
def rate_limit_remaining(_options = {})
|
26
|
+
octokit_warn 'Deprecated: Please use .rate_limit.remaining'
|
27
27
|
rate_limit.remaining
|
28
28
|
end
|
29
29
|
alias ratelimit_remaining rate_limit_remaining
|
@@ -32,8 +32,8 @@ module Octokit
|
|
32
32
|
#
|
33
33
|
# @see https://developer.github.com/v3/rate_limit/#rate-limit
|
34
34
|
# @return [Octokit::RateLimit] Rate limit info
|
35
|
-
def rate_limit!(
|
36
|
-
get
|
35
|
+
def rate_limit!(_options = {})
|
36
|
+
get 'rate_limit'
|
37
37
|
Octokit::RateLimit.from_response(last_response)
|
38
38
|
end
|
39
39
|
alias ratelimit! rate_limit!
|
@@ -42,13 +42,11 @@ module Octokit
|
|
42
42
|
#
|
43
43
|
# @see https://developer.github.com/v3/rate_limit/#rate-limit
|
44
44
|
# @return [Integer] Number of requests remaining in this period
|
45
|
-
def rate_limit_remaining!(
|
46
|
-
octokit_warn
|
45
|
+
def rate_limit_remaining!(_options = {})
|
46
|
+
octokit_warn 'Deprecated: Please use .rate_limit!.remaining'
|
47
47
|
rate_limit!.remaining
|
48
48
|
end
|
49
49
|
alias ratelimit_remaining! rate_limit_remaining!
|
50
|
-
|
51
50
|
end
|
52
51
|
end
|
53
52
|
end
|
54
|
-
|