octokit 4.20.0 → 4.21.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 +5 -5
- data/lib/octokit/client/actions_workflow_runs.rb +11 -0
- data/lib/octokit/client/apps.rb +1 -2
- data/lib/octokit/client/checks.rb +0 -20
- data/lib/octokit/client/organizations.rb +14 -0
- data/lib/octokit/client/refs.rb +12 -0
- data/lib/octokit/client/repositories.rb +18 -0
- data/lib/octokit/error.rb +6 -0
- data/lib/octokit/preview.rb +0 -3
- data/lib/octokit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be4c54d083639a915bef0eb235748b93351f17f2a98e204b7b9f2899c156f2f6
|
4
|
+
data.tar.gz: 21998779cea8f95e63b1814dc264102c1ac69c9d66fef6694ef6442554419bbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14221c5912859f6fa1a9f3dce7d7ee1cb6b5730bc1a95c997e84ff2972f23a3e8eaad723acbabd57982afadc1f4bb1538af510bd10583e21e0f208c7712ce1e6
|
7
|
+
data.tar.gz: 23300ee9b4e73fc660a391018efbc969742dbdc9740faa57ed7609853830689cc1edcca8d445df2d939f2d7353056f828b53ad44b33269573ed06a8e93b8dbd4
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Ruby toolkit for the GitHub API.
|
4
4
|
|
5
|
-
![logo](
|
5
|
+
![logo](https://docs.github.com/assets/images/gundamcat.png)
|
6
6
|
|
7
7
|
Upgrading? Check the [Upgrade Guide](#upgrading-guide) before bumping to a new
|
8
8
|
[major version][semver].
|
@@ -86,10 +86,10 @@ Access the library in Ruby:
|
|
86
86
|
|
87
87
|
```ruby
|
88
88
|
# Provide authentication credentials
|
89
|
-
client = Octokit::Client.new(:
|
89
|
+
client = Octokit::Client.new(:access_token => 'personal_access_token')
|
90
90
|
|
91
|
-
#
|
92
|
-
# client = Octokit::Client.new(:
|
91
|
+
# You can still use the username/password syntax by replacing the password value with your PAT.
|
92
|
+
# client = Octokit::Client.new(:login => 'defunkt', :password => 'personal_access_token')
|
93
93
|
|
94
94
|
# Fetch the current user
|
95
95
|
client.user
|
@@ -323,7 +323,7 @@ custom pattern for traversing large lists.
|
|
323
323
|
|
324
324
|
## Working with GitHub Enterprise
|
325
325
|
|
326
|
-
With a bit of setup, you can also use Octokit with your
|
326
|
+
With a bit of setup, you can also use Octokit with your GitHub Enterprise instance.
|
327
327
|
|
328
328
|
### Interacting with the GitHub.com APIs in GitHub Enterprise
|
329
329
|
|
@@ -65,6 +65,17 @@ module Octokit
|
|
65
65
|
boolean_from_response :post, "#{Repository.path repo}/actions/runs/#{id}/cancel", options
|
66
66
|
end
|
67
67
|
|
68
|
+
# Deletes a workflow run
|
69
|
+
#
|
70
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
71
|
+
# @param id [Integer] Id of a workflow run
|
72
|
+
#
|
73
|
+
# @return [Boolean] Returns true if the run is deleted
|
74
|
+
# @see https://docs.github.com/en/rest/reference/actions#delete-a-workflow-run
|
75
|
+
def delete_workflow_run(repo, id, options = {})
|
76
|
+
boolean_from_response :delete, "#{Repository.path repo}/actions/runs/#{id}", options
|
77
|
+
end
|
78
|
+
|
68
79
|
# Get a download url for archived log files of a workflow run
|
69
80
|
#
|
70
81
|
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
data/lib/octokit/client/apps.rb
CHANGED
@@ -215,8 +215,7 @@ module Octokit
|
|
215
215
|
#
|
216
216
|
# @return [Boolean] Success
|
217
217
|
def delete_installation(installation, options = {})
|
218
|
-
|
219
|
-
boolean_from_response :delete, "app/installations/#{installation}", opts
|
218
|
+
boolean_from_response :delete, "app/installations/#{installation}", options
|
220
219
|
end
|
221
220
|
end
|
222
221
|
end
|
@@ -23,7 +23,6 @@ module Octokit
|
|
23
23
|
# check_run.head_sha # => "7638417db6d59f3c431d3e1f261cc637155684cd"
|
24
24
|
# check_run.status # => "queued"
|
25
25
|
def create_check_run(repo, name, head_sha, options = {})
|
26
|
-
ensure_api_media_type(:checks, options)
|
27
26
|
options[:name] = name
|
28
27
|
options[:head_sha] = head_sha
|
29
28
|
|
@@ -41,8 +40,6 @@ module Octokit
|
|
41
40
|
# check_run.id # => 51295429
|
42
41
|
# check_run.status # => "in_progress"
|
43
42
|
def update_check_run(repo, id, options = {})
|
44
|
-
ensure_api_media_type(:checks, options)
|
45
|
-
|
46
43
|
patch "#{Repository.path repo}/check-runs/#{id}", options
|
47
44
|
end
|
48
45
|
|
@@ -63,8 +60,6 @@ module Octokit
|
|
63
60
|
# result.check_runs[0].id # => 51295429
|
64
61
|
# result.check_runs[0].status # => "in_progress"
|
65
62
|
def check_runs_for_ref(repo, ref, options = {})
|
66
|
-
ensure_api_media_type(:checks, options)
|
67
|
-
|
68
63
|
get "#{Repository.path repo}/commits/#{ref}/check-runs", options
|
69
64
|
end
|
70
65
|
alias :list_check_runs_for_ref :check_runs_for_ref
|
@@ -86,8 +81,6 @@ module Octokit
|
|
86
81
|
# result.check_runs[0].check_suite.id # => 50440400
|
87
82
|
# result.check_runs[0].status # => "in_progress"
|
88
83
|
def check_runs_for_check_suite(repo, id, options = {})
|
89
|
-
ensure_api_media_type(:checks, options)
|
90
|
-
|
91
84
|
get "#{Repository.path repo}/check-suites/#{id}/check-runs", options
|
92
85
|
end
|
93
86
|
alias :list_check_runs_for_check_suite :check_runs_for_check_suite
|
@@ -99,8 +92,6 @@ module Octokit
|
|
99
92
|
# @return [Sawyer::Resource] A hash representing the check run
|
100
93
|
# @see https://developer.github.com/v3/checks/runs/#get-a-single-check-run
|
101
94
|
def check_run(repo, id, options = {})
|
102
|
-
ensure_api_media_type(:checks, options)
|
103
|
-
|
104
95
|
get "#{Repository.path repo}/check-runs/#{id}", options
|
105
96
|
end
|
106
97
|
|
@@ -116,8 +107,6 @@ module Octokit
|
|
116
107
|
# annotations[0].path # => "README.md"
|
117
108
|
# annotations[0].message # => "Looks good!"
|
118
109
|
def check_run_annotations(repo, id, options = {})
|
119
|
-
ensure_api_media_type(:checks, options)
|
120
|
-
|
121
110
|
get "#{Repository.path repo}/check-runs/#{id}/annotations", options
|
122
111
|
end
|
123
112
|
|
@@ -132,8 +121,6 @@ module Octokit
|
|
132
121
|
# @return [Sawyer::Resource] A hash representing the check suite
|
133
122
|
# @see https://developer.github.com/v3/checks/suites/#get-a-single-check-suite
|
134
123
|
def check_suite(repo, id, options = {})
|
135
|
-
ensure_api_media_type(:checks, options)
|
136
|
-
|
137
124
|
get "#{Repository.path repo}/check-suites/#{id}", options
|
138
125
|
end
|
139
126
|
|
@@ -153,8 +140,6 @@ module Octokit
|
|
153
140
|
# result.check_suites[0].id # => 50440400
|
154
141
|
# result.check_suites[0].app.id # => 76765
|
155
142
|
def check_suites_for_ref(repo, ref, options = {})
|
156
|
-
ensure_api_media_type(:checks, options)
|
157
|
-
|
158
143
|
get "#{Repository.path repo}/commits/#{ref}/check-suites", options
|
159
144
|
end
|
160
145
|
alias :list_check_suites_for_ref :check_suites_for_ref
|
@@ -172,8 +157,6 @@ module Octokit
|
|
172
157
|
# result.preferences.auto_trigger_checks[0].setting # => false
|
173
158
|
# result.repository.full_name # => "octocat/Hello-World"
|
174
159
|
def set_check_suite_preferences(repo, options = {})
|
175
|
-
ensure_api_media_type(:checks, options)
|
176
|
-
|
177
160
|
patch "#{Repository.path repo}/check-suites/preferences", options
|
178
161
|
end
|
179
162
|
|
@@ -188,7 +171,6 @@ module Octokit
|
|
188
171
|
# check_suite.head_sha # => "7638417db6d59f3c431d3e1f261cc637155684cd"
|
189
172
|
# check_suite.status # => "queued"
|
190
173
|
def create_check_suite(repo, head_sha, options = {})
|
191
|
-
ensure_api_media_type(:checks, options)
|
192
174
|
options[:head_sha] = head_sha
|
193
175
|
|
194
176
|
post "#{Repository.path repo}/check-suites", options
|
@@ -201,8 +183,6 @@ module Octokit
|
|
201
183
|
# @return [Boolean] True if successful, raises an error otherwise
|
202
184
|
# @see https://developer.github.com/v3/checks/suites/#rerequest-check-suite
|
203
185
|
def rerequest_check_suite(repo, id, options = {})
|
204
|
-
ensure_api_media_type(:checks, options)
|
205
|
-
|
206
186
|
post "#{Repository.path repo}/check-suites/#{id}/rerequest", options
|
207
187
|
true
|
208
188
|
end
|
@@ -801,6 +801,20 @@ module Octokit
|
|
801
801
|
options = ensure_api_media_type(:migrations, options)
|
802
802
|
delete "#{Organization.path(org)}/migrations/#{id}/repos/#{repo}/lock", options
|
803
803
|
end
|
804
|
+
|
805
|
+
# Get GitHub Actions billing for an organization
|
806
|
+
#
|
807
|
+
# Requires authenticated organization owner.
|
808
|
+
#
|
809
|
+
# @param org [String, Integer] Organization GitHub login or id.
|
810
|
+
# @return [Sawyer::Resource] Hash representing GitHub Actions billing for an organization.
|
811
|
+
# @see https://docs.github.com/en/rest/reference/billing#get-github-actions-billing-for-an-organization
|
812
|
+
#
|
813
|
+
# @example
|
814
|
+
# @client.billing_actions('github')
|
815
|
+
def billing_actions(org)
|
816
|
+
get "#{Organization.path(org)}/settings/billing/actions"
|
817
|
+
end
|
804
818
|
end
|
805
819
|
end
|
806
820
|
end
|
data/lib/octokit/client/refs.rb
CHANGED
@@ -23,6 +23,18 @@ module Octokit
|
|
23
23
|
alias :references :refs
|
24
24
|
alias :list_references :refs
|
25
25
|
|
26
|
+
# Fetch matching refs
|
27
|
+
#
|
28
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
29
|
+
# @param ref [String] The ref, e.g. <tt>tags/v0.0.3</tt> or <tt>heads/rails-3</tt>
|
30
|
+
# @return [Array<Sawyer::Resource>] The reference matching the given repo and the ref id
|
31
|
+
# @see https://developer.github.com/v3/git/refs/#list-matching-references
|
32
|
+
# @example Fetch refs matching tags/v2 for sferik/rails_admin
|
33
|
+
# Octokit.ref("sferik/rails_admin","tags/v2")
|
34
|
+
def matching_refs(repo, ref, options = {})
|
35
|
+
paginate "#{Repository.path repo}/git/matching-refs/#{ref}", options
|
36
|
+
end
|
37
|
+
|
26
38
|
# Fetch a given reference
|
27
39
|
#
|
28
40
|
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
@@ -640,6 +640,24 @@ module Octokit
|
|
640
640
|
boolean_from_response :delete, "#{Repository.path repo}/branches/#{branch}/protection", opts
|
641
641
|
end
|
642
642
|
|
643
|
+
# Rename a single branch from a repository
|
644
|
+
#
|
645
|
+
# Requires authenticated client
|
646
|
+
#
|
647
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository.
|
648
|
+
# @param branch [String] Current branch name
|
649
|
+
# @param new_name [String] New branch name
|
650
|
+
# @return [Sawyer::Resource] The renamed branch
|
651
|
+
# @see https://developer.github.com/v3/repos/#rename-a-branch
|
652
|
+
# @example
|
653
|
+
# @client.rename_branch('octokit/octokit.rb', 'master', 'main')
|
654
|
+
def rename_branch(repo, branch, new_name, options = {})
|
655
|
+
params = {
|
656
|
+
new_name: new_name,
|
657
|
+
}
|
658
|
+
post "#{Repository.path repo}/branches/#{branch}/rename", params.merge(options)
|
659
|
+
end
|
660
|
+
|
643
661
|
# List users available for assigning to issues.
|
644
662
|
#
|
645
663
|
# Requires authenticated client for private repos.
|
data/lib/octokit/error.rb
CHANGED
@@ -106,6 +106,8 @@ module Octokit
|
|
106
106
|
def self.error_for_422(body)
|
107
107
|
if body =~ /PullRequestReviewComment/i && body =~ /(commit_id|end_commit_oid) is not part of the pull request/i
|
108
108
|
Octokit::CommitIsNotPartOfPullRequest
|
109
|
+
elsif body =~ /Path diff too large/i
|
110
|
+
Octokit::PathDiffTooLarge
|
109
111
|
else
|
110
112
|
Octokit::UnprocessableEntity
|
111
113
|
end
|
@@ -314,6 +316,10 @@ module Octokit
|
|
314
316
|
# and body matches 'PullRequestReviewComment' and 'commit_id (or end_commit_oid) is not part of the pull request'
|
315
317
|
class CommitIsNotPartOfPullRequest < UnprocessableEntity; end
|
316
318
|
|
319
|
+
# Raised when GitHub returns a 422 HTTP status code and body matches 'Path diff too large'.
|
320
|
+
# It could occur when attempting to post review comments on a "too large" file.
|
321
|
+
class PathDiffTooLarge < UnprocessableEntity; end
|
322
|
+
|
317
323
|
# Raised when GitHub returns a 451 HTTP status code
|
318
324
|
class UnavailableForLegalReasons < ClientError; end
|
319
325
|
|
data/lib/octokit/preview.rb
CHANGED
@@ -6,7 +6,6 @@ module Octokit
|
|
6
6
|
PREVIEW_TYPES = {
|
7
7
|
:applications_api => 'application/vnd.github.doctor-strange-preview+json'.freeze,
|
8
8
|
:branch_protection => 'application/vnd.github.luke-cage-preview+json'.freeze,
|
9
|
-
:checks => 'application/vnd.github.antiope-preview+json'.freeze,
|
10
9
|
:commit_search => 'application/vnd.github.cloak-preview+json'.freeze,
|
11
10
|
:commit_pulls => 'application/vnd.github.groot-preview+json'.freeze,
|
12
11
|
:commit_branches => 'application/vnd.github.groot-preview+json'.freeze,
|
@@ -23,9 +22,7 @@ module Octokit
|
|
23
22
|
:topics => 'application/vnd.github.mercy-preview+json'.freeze,
|
24
23
|
:community_profile => 'application/vnd.github.black-panther-preview+json'.freeze,
|
25
24
|
:strict_validation => 'application/vnd.github.speedy-preview+json'.freeze,
|
26
|
-
:drafts => 'application/vnd.github.shadow-cat-preview'.freeze,
|
27
25
|
:template_repositories => 'application/vnd.github.baptiste-preview+json'.freeze,
|
28
|
-
:uninstall_github_app => 'application/vnd.github.gambit-preview+json'.freeze,
|
29
26
|
:project_card_events => 'application/vnd.github.starfox-preview+json'.freeze,
|
30
27
|
:vulnerability_alerts => 'application/vnd.github.dorian-preview+json'.freeze,
|
31
28
|
}
|
data/lib/octokit/version.rb
CHANGED
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.
|
4
|
+
version: 4.21.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:
|
13
|
+
date: 2021-04-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|