octokit 4.13.0 → 4.19.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/CONTRIBUTING.md +14 -13
- data/README.md +38 -12
- data/lib/octokit/authentication.rb +2 -11
- data/lib/octokit/client.rb +21 -10
- data/lib/octokit/client/actions_secrets.rb +58 -0
- data/lib/octokit/client/actions_workflow_runs.rb +94 -0
- data/lib/octokit/client/actions_workflows.rb +43 -0
- data/lib/octokit/client/apps.rb +34 -8
- data/lib/octokit/client/authorizations.rb +2 -70
- data/lib/octokit/client/checks.rb +211 -0
- data/lib/octokit/client/commit_branches.rb +20 -0
- data/lib/octokit/client/commit_pulls.rb +20 -0
- data/lib/octokit/client/events.rb +1 -0
- data/lib/octokit/client/issues.rb +7 -2
- data/lib/octokit/client/oauth_applications.rb +122 -0
- data/lib/octokit/client/organizations.rb +24 -10
- data/lib/octokit/client/projects.rb +1 -1
- data/lib/octokit/client/pull_requests.rb +1 -1
- data/lib/octokit/client/refs.rb +7 -3
- data/lib/octokit/client/repositories.rb +47 -10
- data/lib/octokit/client/repository_invitations.rb +1 -1
- data/lib/octokit/client/reviews.rb +18 -0
- data/lib/octokit/client/search.rb +1 -1
- data/lib/octokit/client/users.rb +86 -0
- data/lib/octokit/connection.rb +14 -3
- data/lib/octokit/error.rb +33 -1
- data/lib/octokit/middleware/follow_redirects.rb +1 -1
- data/lib/octokit/preview.rb +9 -1
- data/lib/octokit/rate_limit.rb +1 -1
- data/lib/octokit/repository.rb +1 -1
- data/lib/octokit/version.rb +1 -1
- data/octokit.gemspec +2 -1
- metadata +34 -8
data/lib/octokit/client/apps.rb
CHANGED
@@ -4,11 +4,23 @@ module Octokit
|
|
4
4
|
# Methods for the Apps API
|
5
5
|
module Apps
|
6
6
|
|
7
|
+
# Get the authenticated App
|
8
|
+
#
|
9
|
+
# @param options [Hash] A customizable set of options
|
10
|
+
#
|
11
|
+
# @see https://developer.github.com/v3/apps/#get-the-authenticated-app
|
12
|
+
#
|
13
|
+
# @return [Sawyer::Resource] App information
|
14
|
+
def app(options = {})
|
15
|
+
opts = ensure_api_media_type(:integrations, options)
|
16
|
+
get "app", opts
|
17
|
+
end
|
18
|
+
|
7
19
|
# Find all installations that belong to an App
|
8
20
|
#
|
9
21
|
# @param options [Hash] A customizable set of options
|
10
22
|
#
|
11
|
-
# @see https://developer.github.com/v3/apps/#
|
23
|
+
# @see https://developer.github.com/v3/apps/#list-installations
|
12
24
|
#
|
13
25
|
# @return [Array<Sawyer::Resource>] the total_count and an array of installations
|
14
26
|
def find_app_installations(options = {})
|
@@ -31,7 +43,7 @@ module Octokit
|
|
31
43
|
#
|
32
44
|
# @param options [Hash] A customizable set of options
|
33
45
|
#
|
34
|
-
# @see https://developer.github.com/v3/apps/#list-installations-for-user
|
46
|
+
# @see https://developer.github.com/v3/apps/installations/#list-installations-for-a-user
|
35
47
|
#
|
36
48
|
# @return [Sawyer::Resource] the total_count and an array of installations
|
37
49
|
def find_user_installations(options = {})
|
@@ -45,7 +57,7 @@ module Octokit
|
|
45
57
|
#
|
46
58
|
# @param id [Integer] Installation id
|
47
59
|
#
|
48
|
-
# @see https://developer.github.com/v3/apps/#get-
|
60
|
+
# @see https://developer.github.com/v3/apps/#get-an-installation
|
49
61
|
#
|
50
62
|
# @return [Sawyer::Resource] Installation information
|
51
63
|
def installation(id, options = {})
|
@@ -58,7 +70,7 @@ module Octokit
|
|
58
70
|
# @param installation [Integer] The id of a GitHub App Installation
|
59
71
|
# @param options [Hash] A customizable set of options
|
60
72
|
#
|
61
|
-
# @see https://developer.github.com/v3/apps/#
|
73
|
+
# @see https://developer.github.com/v3/apps/#create-a-new-installation-token
|
62
74
|
#
|
63
75
|
# @return [<Sawyer::Resource>] An installation token
|
64
76
|
def create_app_installation_access_token(installation, options = {})
|
@@ -82,7 +94,7 @@ module Octokit
|
|
82
94
|
# @param organization [String] Organization GitHub login
|
83
95
|
# @param options [Hash] A customizable set of options
|
84
96
|
#
|
85
|
-
# @see https://developer.github.com/v3/apps/#
|
97
|
+
# @see https://developer.github.com/v3/apps/#get-an-organization-installation
|
86
98
|
#
|
87
99
|
# @return [Sawyer::Resource] Installation information
|
88
100
|
def find_organization_installation(organization, options = {})
|
@@ -95,7 +107,7 @@ module Octokit
|
|
95
107
|
# @param repo [String] A GitHub repository
|
96
108
|
# @param options [Hash] A customizable set of options
|
97
109
|
#
|
98
|
-
# @see https://developer.github.com/v3/apps/#
|
110
|
+
# @see https://developer.github.com/v3/apps/#get-a-repository-installation
|
99
111
|
#
|
100
112
|
# @return [Sawyer::Resource] Installation information
|
101
113
|
def find_repository_installation(repo, options = {})
|
@@ -108,7 +120,7 @@ module Octokit
|
|
108
120
|
# @param user [String] GitHub user login
|
109
121
|
# @param options [Hash] A customizable set of options
|
110
122
|
#
|
111
|
-
# @see https://developer.github.com/v3/apps/#
|
123
|
+
# @see https://developer.github.com/v3/apps/#get-a-user-installation
|
112
124
|
#
|
113
125
|
# @return [Sawyer::Resource] Installation information
|
114
126
|
def find_user_installation(user, options = {})
|
@@ -119,6 +131,7 @@ module Octokit
|
|
119
131
|
# List repositories that are accessible to the authenticated installation
|
120
132
|
#
|
121
133
|
# @param options [Hash] A customizable set of options
|
134
|
+
#
|
122
135
|
# @see https://developer.github.com/v3/apps/installations/#list-repositories
|
123
136
|
#
|
124
137
|
# @return [Sawyer::Resource] the total_count and an array of repositories
|
@@ -195,7 +208,7 @@ module Octokit
|
|
195
208
|
# @param installation [Integer] The id of a GitHub App Installation
|
196
209
|
# @param options [Hash] A customizable set of options
|
197
210
|
#
|
198
|
-
# @see https://developer.github.com/apps/
|
211
|
+
# @see https://developer.github.com/v3/apps/installations/#list-repositories-accessible-to-the-user-for-an-installation
|
199
212
|
#
|
200
213
|
# @return [Sawyer::Resource] the total_count and an array of repositories
|
201
214
|
def find_installation_repositories_for_user(installation, options = {})
|
@@ -204,6 +217,19 @@ module Octokit
|
|
204
217
|
data.repositories.concat last_response.data.repositories
|
205
218
|
end
|
206
219
|
end
|
220
|
+
|
221
|
+
# Delete an installation and uninstall a GitHub App
|
222
|
+
#
|
223
|
+
# @param installation [Integer] The id of a GitHub App Installation
|
224
|
+
# @param options [Hash] A customizable set of options
|
225
|
+
#
|
226
|
+
# @see https://developer.github.com/v3/apps/#delete-an-installation
|
227
|
+
#
|
228
|
+
# @return [Boolean] Success
|
229
|
+
def delete_installation(installation, options = {})
|
230
|
+
opts = ensure_api_media_type(:uninstall_github_app, options)
|
231
|
+
boolean_from_response :delete, "app/installations/#{installation}", opts
|
232
|
+
end
|
207
233
|
end
|
208
234
|
end
|
209
235
|
end
|
@@ -59,7 +59,7 @@ module Octokit
|
|
59
59
|
# client = Octokit::Client.new(:login => 'ctshryock', :password => 'secret')
|
60
60
|
# client.create_authorization({:idempotent => true, :client_id => 'xxxx', :client_secret => 'yyyy', :scopes => ["user"]})
|
61
61
|
def create_authorization(options = {})
|
62
|
-
#
|
62
|
+
# Technically we can omit scopes as GitHub has a default, however the
|
63
63
|
# API will reject us if we send a POST request with an empty body.
|
64
64
|
options = options.dup
|
65
65
|
if options.delete :idempotent
|
@@ -140,74 +140,6 @@ module Octokit
|
|
140
140
|
sort
|
141
141
|
end
|
142
142
|
|
143
|
-
# Check if a token is valid.
|
144
|
-
#
|
145
|
-
# Applications can check if a token is valid without rate limits.
|
146
|
-
#
|
147
|
-
# @param token [String] 40 character GitHub OAuth access token
|
148
|
-
#
|
149
|
-
# @return [Sawyer::Resource] A single authorization for the authenticated user
|
150
|
-
# @see https://developer.github.com/v3/oauth_authorizations/#check-an-authorization
|
151
|
-
# @example
|
152
|
-
# client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
|
153
|
-
# client.check_application_authorization('deadbeef1234567890deadbeef987654321')
|
154
|
-
def check_application_authorization(token, options = {})
|
155
|
-
opts = options.dup
|
156
|
-
key = opts.delete(:client_id) || client_id
|
157
|
-
secret = opts.delete(:client_secret) || client_secret
|
158
|
-
|
159
|
-
as_app(key, secret) do |app_client|
|
160
|
-
app_client.get "applications/#{client_id}/tokens/#{token}", opts
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
# Reset a token
|
165
|
-
#
|
166
|
-
# Applications can reset a token without requiring a user to re-authorize.
|
167
|
-
#
|
168
|
-
# @param token [String] 40 character GitHub OAuth access token
|
169
|
-
#
|
170
|
-
# @return [Sawyer::Resource] A single authorization for the authenticated user
|
171
|
-
# @see https://developer.github.com/v3/oauth_authorizations/#reset-an-authorization
|
172
|
-
# @example
|
173
|
-
# client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
|
174
|
-
# client.reset_application_authorization('deadbeef1234567890deadbeef987654321')
|
175
|
-
def reset_application_authorization(token, options = {})
|
176
|
-
opts = options.dup
|
177
|
-
key = opts.delete(:client_id) || client_id
|
178
|
-
secret = opts.delete(:client_secret) || client_secret
|
179
|
-
|
180
|
-
as_app(key, secret) do |app_client|
|
181
|
-
app_client.post "applications/#{client_id}/tokens/#{token}", opts
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
# Revoke a token
|
186
|
-
#
|
187
|
-
# Applications can revoke (delete) a token
|
188
|
-
#
|
189
|
-
# @param token [String] 40 character GitHub OAuth access token
|
190
|
-
#
|
191
|
-
# @return [Boolean] Result
|
192
|
-
# @see https://developer.github.com/v3/oauth_authorizations/#revoke-an-authorization-for-an-application
|
193
|
-
# @example
|
194
|
-
# client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
|
195
|
-
# client.revoke_application_authorization('deadbeef1234567890deadbeef987654321')
|
196
|
-
def revoke_application_authorization(token, options = {})
|
197
|
-
opts = options.dup
|
198
|
-
key = opts.delete(:client_id) || client_id
|
199
|
-
secret = opts.delete(:client_secret) || client_secret
|
200
|
-
|
201
|
-
as_app(key, secret) do |app_client|
|
202
|
-
app_client.delete "applications/#{client_id}/tokens/#{token}", opts
|
203
|
-
|
204
|
-
app_client.last_response.status == 204
|
205
|
-
end
|
206
|
-
rescue Octokit::NotFound
|
207
|
-
false
|
208
|
-
end
|
209
|
-
alias :delete_application_authorization :revoke_application_authorization
|
210
|
-
|
211
143
|
# Revoke all tokens for an app
|
212
144
|
#
|
213
145
|
# Applications can revoke all of their tokens in a single request
|
@@ -233,7 +165,7 @@ module Octokit
|
|
233
165
|
def authorize_url(app_id = client_id, options = {})
|
234
166
|
opts = options.dup
|
235
167
|
if app_id.to_s.empty?
|
236
|
-
raise Octokit::ApplicationCredentialsRequired
|
168
|
+
raise Octokit::ApplicationCredentialsRequired, "client_id required"
|
237
169
|
end
|
238
170
|
authorize_url = opts.delete(:endpoint) || Octokit.web_endpoint
|
239
171
|
authorize_url << "login/oauth/authorize?client_id=#{app_id}"
|
@@ -0,0 +1,211 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Checks API
|
5
|
+
#
|
6
|
+
# @see https://developer.github.com/v3/checks/
|
7
|
+
module Checks
|
8
|
+
|
9
|
+
# Methods for Check Runs
|
10
|
+
#
|
11
|
+
# @see https://developer.github.com/v3/checks/runs/
|
12
|
+
|
13
|
+
# Create a check run
|
14
|
+
#
|
15
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
16
|
+
# @param name [String] The name of the check
|
17
|
+
# @param head_sha [String] The SHA of the commit to check
|
18
|
+
# @return [Sawyer::Resource] A hash representing the new check run
|
19
|
+
# @see https://developer.github.com/v3/checks/runs/#create-a-check-run
|
20
|
+
# @example Create a check run
|
21
|
+
# check_run = @client.create_check_run("octocat/Hello-World", "my-check", "7638417db6d59f3c431d3e1f261cc637155684cd")
|
22
|
+
# check_run.name # => "my-check"
|
23
|
+
# check_run.head_sha # => "7638417db6d59f3c431d3e1f261cc637155684cd"
|
24
|
+
# check_run.status # => "queued"
|
25
|
+
def create_check_run(repo, name, head_sha, options = {})
|
26
|
+
ensure_api_media_type(:checks, options)
|
27
|
+
options[:name] = name
|
28
|
+
options[:head_sha] = head_sha
|
29
|
+
|
30
|
+
post "#{Repository.path repo}/check-runs", options
|
31
|
+
end
|
32
|
+
|
33
|
+
# Update a check run
|
34
|
+
#
|
35
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
36
|
+
# @param id [Integer] The ID of the check run
|
37
|
+
# @return [Sawyer::Resource] A hash representing the updated check run
|
38
|
+
# @see https://developer.github.com/v3/checks/runs/#update-a-check-run
|
39
|
+
# @example Update a check run
|
40
|
+
# check_run = @client.update_check_run("octocat/Hello-World", 51295429, status: "in_progress")
|
41
|
+
# check_run.id # => 51295429
|
42
|
+
# check_run.status # => "in_progress"
|
43
|
+
def update_check_run(repo, id, options = {})
|
44
|
+
ensure_api_media_type(:checks, options)
|
45
|
+
|
46
|
+
patch "#{Repository.path repo}/check-runs/#{id}", options
|
47
|
+
end
|
48
|
+
|
49
|
+
# List check runs for a specific ref
|
50
|
+
#
|
51
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
52
|
+
# @param ref [String] A SHA, branch name, or tag name
|
53
|
+
# @param options [Hash] A set of optional filters
|
54
|
+
# @option options [String] :check_name Returns check runs with the specified <tt>name</tt>
|
55
|
+
# @option options [String] :status Returns check runs with the specified <tt>status</tt>
|
56
|
+
# @option options [String] :filter Filters check runs by their <tt>completed_at</tt> timestamp
|
57
|
+
# @return [Sawyer::Resource] A hash representing a collection of check runs
|
58
|
+
# @see https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-specific-ref
|
59
|
+
# @example List check runs for a specific ref
|
60
|
+
# result = @client.check_runs_for_ref("octocat/Hello-World", "7638417db6d59f3c431d3e1f261cc637155684cd", status: "in_progress")
|
61
|
+
# result.total_count # => 1
|
62
|
+
# result.check_runs.count # => 1
|
63
|
+
# result.check_runs[0].id # => 51295429
|
64
|
+
# result.check_runs[0].status # => "in_progress"
|
65
|
+
def check_runs_for_ref(repo, ref, options = {})
|
66
|
+
ensure_api_media_type(:checks, options)
|
67
|
+
|
68
|
+
get "#{Repository.path repo}/commits/#{ref}/check-runs", options
|
69
|
+
end
|
70
|
+
alias :list_check_runs_for_ref :check_runs_for_ref
|
71
|
+
|
72
|
+
# List check runs in a check suite
|
73
|
+
#
|
74
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
75
|
+
# @param id [Integer] The ID of the check suite
|
76
|
+
# @param options [Hash] A set of optional filters
|
77
|
+
# @option options [String] :check_name Returns check runs with the specified <tt>name</tt>
|
78
|
+
# @option options [String] :status Returns check runs with the specified <tt>status</tt>
|
79
|
+
# @option options [String] :filter Filters check runs by their <tt>completed_at</tt> timestamp
|
80
|
+
# @return [Sawyer::Resource] A hash representing a collection of check runs
|
81
|
+
# @see https://developer.github.com/v3/checks/runs/#list-check-runs-in-a-check-suite
|
82
|
+
# @example List check runs in a check suite
|
83
|
+
# result = @client.check_runs_for_check_suite("octocat/Hello-World", 50440400, status: "in_progress")
|
84
|
+
# result.total_count # => 1
|
85
|
+
# result.check_runs.count # => 1
|
86
|
+
# result.check_runs[0].check_suite.id # => 50440400
|
87
|
+
# result.check_runs[0].status # => "in_progress"
|
88
|
+
def check_runs_for_check_suite(repo, id, options = {})
|
89
|
+
ensure_api_media_type(:checks, options)
|
90
|
+
|
91
|
+
get "#{Repository.path repo}/check-suites/#{id}/check-runs", options
|
92
|
+
end
|
93
|
+
alias :list_check_runs_for_check_suite :check_runs_for_check_suite
|
94
|
+
|
95
|
+
# Get a single check run
|
96
|
+
#
|
97
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
98
|
+
# @param id [Integer] The ID of the check run
|
99
|
+
# @return [Sawyer::Resource] A hash representing the check run
|
100
|
+
# @see https://developer.github.com/v3/checks/runs/#get-a-single-check-run
|
101
|
+
def check_run(repo, id, options = {})
|
102
|
+
ensure_api_media_type(:checks, options)
|
103
|
+
|
104
|
+
get "#{Repository.path repo}/check-runs/#{id}", options
|
105
|
+
end
|
106
|
+
|
107
|
+
# List annotations for a check run
|
108
|
+
#
|
109
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
110
|
+
# @param id [Integer] The ID of the check run
|
111
|
+
# @return [Array<Sawyer::Resource>] An array of hashes representing check run annotations
|
112
|
+
# @see https://developer.github.com/v3/checks/runs/#list-annotations-for-a-check-run
|
113
|
+
# @example List annotations for a check run
|
114
|
+
# annotations = @client.check_run_annotations("octocat/Hello-World", 51295429)
|
115
|
+
# annotations.count # => 1
|
116
|
+
# annotations[0].path # => "README.md"
|
117
|
+
# annotations[0].message # => "Looks good!"
|
118
|
+
def check_run_annotations(repo, id, options = {})
|
119
|
+
ensure_api_media_type(:checks, options)
|
120
|
+
|
121
|
+
get "#{Repository.path repo}/check-runs/#{id}/annotations", options
|
122
|
+
end
|
123
|
+
|
124
|
+
# Methods for Check Suites
|
125
|
+
#
|
126
|
+
# @see https://developer.github.com/v3/checks/suites/
|
127
|
+
|
128
|
+
# Get a single check suite
|
129
|
+
#
|
130
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
131
|
+
# @param id [Integer] The ID of the check suite
|
132
|
+
# @return [Sawyer::Resource] A hash representing the check suite
|
133
|
+
# @see https://developer.github.com/v3/checks/suites/#get-a-single-check-suite
|
134
|
+
def check_suite(repo, id, options = {})
|
135
|
+
ensure_api_media_type(:checks, options)
|
136
|
+
|
137
|
+
get "#{Repository.path repo}/check-suites/#{id}", options
|
138
|
+
end
|
139
|
+
|
140
|
+
# List check suites for a specific ref
|
141
|
+
#
|
142
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
143
|
+
# @param ref [String] A SHA, branch name, or tag name
|
144
|
+
# @param options [Hash] A set of optional filters
|
145
|
+
# @option options [Integer] :app_id Filters check suites by GitHub App <tt>id</tt>
|
146
|
+
# @option options [String] :check_name Filters checks suites by the <tt>name</tt> of the check run
|
147
|
+
# @return [Sawyer::Resource] A hash representing a collection of check suites
|
148
|
+
# @see https://developer.github.com/v3/checks/suites/#list-check-suites-for-a-specific-ref
|
149
|
+
# @example List check suites for a specific ref
|
150
|
+
# result = @client.check_suites_for_ref("octocat/Hello-World", "7638417db6d59f3c431d3e1f261cc637155684cd", app_id: 76765)
|
151
|
+
# result.total_count # => 1
|
152
|
+
# result.check_suites.count # => 1
|
153
|
+
# result.check_suites[0].id # => 50440400
|
154
|
+
# result.check_suites[0].app.id # => 76765
|
155
|
+
def check_suites_for_ref(repo, ref, options = {})
|
156
|
+
ensure_api_media_type(:checks, options)
|
157
|
+
|
158
|
+
get "#{Repository.path repo}/commits/#{ref}/check-suites", options
|
159
|
+
end
|
160
|
+
alias :list_check_suites_for_ref :check_suites_for_ref
|
161
|
+
|
162
|
+
# Set preferences for check suites on a repository
|
163
|
+
#
|
164
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
165
|
+
# @param options [Hash] Preferences to set
|
166
|
+
# @return [Sawyer::Resource] A hash representing the repository's check suite preferences
|
167
|
+
# @see https://developer.github.com/v3/checks/suites/#set-preferences-for-check-suites-on-a-repository
|
168
|
+
# @example Set preferences for check suites on a repository
|
169
|
+
# result = @client.set_check_suite_preferences("octocat/Hello-World", auto_trigger_checks: [{ app_id: 76765, setting: false }])
|
170
|
+
# result.preferences.auto_trigger_checks.count # => 1
|
171
|
+
# result.preferences.auto_trigger_checks[0].app_id # => 76765
|
172
|
+
# result.preferences.auto_trigger_checks[0].setting # => false
|
173
|
+
# result.repository.full_name # => "octocat/Hello-World"
|
174
|
+
def set_check_suite_preferences(repo, options = {})
|
175
|
+
ensure_api_media_type(:checks, options)
|
176
|
+
|
177
|
+
patch "#{Repository.path repo}/check-suites/preferences", options
|
178
|
+
end
|
179
|
+
|
180
|
+
# Create a check suite
|
181
|
+
#
|
182
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
183
|
+
# @param head_sha [String] The SHA of the commit to check
|
184
|
+
# @return [Sawyer::Resource] A hash representing the new check suite
|
185
|
+
# @see https://developer.github.com/v3/checks/suites/#create-a-check-suite
|
186
|
+
# @example Create a check suite
|
187
|
+
# check_suite = @client.create_check_suite("octocat/Hello-World", "7638417db6d59f3c431d3e1f261cc637155684cd")
|
188
|
+
# check_suite.head_sha # => "7638417db6d59f3c431d3e1f261cc637155684cd"
|
189
|
+
# check_suite.status # => "queued"
|
190
|
+
def create_check_suite(repo, head_sha, options = {})
|
191
|
+
ensure_api_media_type(:checks, options)
|
192
|
+
options[:head_sha] = head_sha
|
193
|
+
|
194
|
+
post "#{Repository.path repo}/check-suites", options
|
195
|
+
end
|
196
|
+
|
197
|
+
# Rerequest check suite
|
198
|
+
#
|
199
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
200
|
+
# @param id [Integer] The ID of the check suite
|
201
|
+
# @return [Boolean] True if successful, raises an error otherwise
|
202
|
+
# @see https://developer.github.com/v3/checks/suites/#rerequest-check-suite
|
203
|
+
def rerequest_check_suite(repo, id, options = {})
|
204
|
+
ensure_api_media_type(:checks, options)
|
205
|
+
|
206
|
+
post "#{Repository.path repo}/check-suites/#{id}/rerequest", options
|
207
|
+
true
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Branches for HEAD API
|
5
|
+
#
|
6
|
+
# @see https://developer.github.com/v3/repos/commits/
|
7
|
+
module CommitBranches
|
8
|
+
|
9
|
+
# List branches for a single HEAD commit
|
10
|
+
#
|
11
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
12
|
+
# @param sha [String] The SHA of the commit whose branches will be fetched
|
13
|
+
# @return [Array] List of branches
|
14
|
+
# @see https://developer.github.com/v3/repos/commits/#list-branches-for-head-commit
|
15
|
+
def commit_branches(repo, sha, options = {})
|
16
|
+
paginate "#{Repository.path repo}/commits/#{sha}/branches-where-head", options
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Commit Pulls API
|
5
|
+
#
|
6
|
+
# @see https://developer.github.com/v3/repos/comments/
|
7
|
+
module CommitPulls
|
8
|
+
|
9
|
+
# List pulls for a single commit
|
10
|
+
#
|
11
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
12
|
+
# @param sha [String] The SHA of the commit whose pulls will be fetched
|
13
|
+
# @return [Array] List of commit pulls
|
14
|
+
# @see https://developer.github.com/v3/repos/commits/#list-pull-requests-associated-with-commit
|
15
|
+
def commit_pulls(repo, sha, options = {})
|
16
|
+
paginate "#{Repository.path repo}/commits/#{sha}/pulls", options
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|