octokit 5.3.0 → 5.6.1
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 +2 -2
- data/lib/octokit/client/actions_artifacts.rb +67 -0
- data/lib/octokit/client/organizations.rb +41 -0
- data/lib/octokit/client/projects.rb +1 -1
- data/lib/octokit/client.rb +2 -0
- data/lib/octokit/error.rb +1 -1
- data/lib/octokit/version.rb +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbf0b3ef2f8550628d4bde2fa55f7bcb97261364e94aac9f5a149ce6e86fa019
|
4
|
+
data.tar.gz: d336c02e28efb73618c1c24827b2b7703dc5341ce95087467089cf36f11d96fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 960aacdc0e1a37794e6bed1a0c5f2686c1dca5160c0802cb449590f92ecab4cf243a0201b65e419fe3ffa38c194f106eceed0d46c90f63ceeb8a4aa14b22d716
|
7
|
+
data.tar.gz: 22a81c032d49f11c2f3875bfbc1c577449787d0899f20d0108dc7de868a2b5f1c86163ccebf46eb4a4b2567277c46fd83aca619c071a238746229664894008bf
|
data/README.md
CHANGED
@@ -79,7 +79,7 @@ Install via Rubygems
|
|
79
79
|
|
80
80
|
... or add to your Gemfile
|
81
81
|
|
82
|
-
gem "octokit", "~>
|
82
|
+
gem "octokit", "~> 5.0"
|
83
83
|
|
84
84
|
Access the library in Ruby:
|
85
85
|
|
@@ -664,7 +664,7 @@ Once configured, the middleware will store responses in cache based on ETag
|
|
664
664
|
fingerprint and serve those back up for future `304` responses for the same
|
665
665
|
resource. See the [project README][cache] for advanced usage.
|
666
666
|
|
667
|
-
[cache]: https://github.com/
|
667
|
+
[cache]: https://github.com/sourcelevel/faraday-http-cache
|
668
668
|
[faraday]: https://github.com/lostisland/faraday
|
669
669
|
|
670
670
|
## Hacking on Octokit.rb
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Octokit
|
4
|
+
class Client
|
5
|
+
# Methods for the Actions Artifacts API
|
6
|
+
#
|
7
|
+
# @see https://developer.github.com/v3/actions/artifacts
|
8
|
+
module ActionsArtifacts
|
9
|
+
# List all artifacts for a repository
|
10
|
+
#
|
11
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
12
|
+
#
|
13
|
+
# @return [Sawyer::Resource] the total count and an array of artifacts
|
14
|
+
# @see https://developer.github.com/v3/actions/artifacts#list-artifacts-for-a-repository
|
15
|
+
def repository_artifacts(repo, options = {})
|
16
|
+
paginate "#{Repository.path repo}/actions/artifacts", options
|
17
|
+
end
|
18
|
+
|
19
|
+
# List all artifacts for a workflow run
|
20
|
+
#
|
21
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
22
|
+
# @param workflow_run_id [Integer] Id of a workflow run
|
23
|
+
#
|
24
|
+
# @return [Sawyer::Resource] the total count and an array of artifacts
|
25
|
+
# @see https://docs.github.com/en/rest/actions/artifacts#list-workflow-run-artifacts
|
26
|
+
def workflow_run_artifacts(repo, workflow_run_id, options = {})
|
27
|
+
paginate "#{Repository.path repo}/actions/runs/#{workflow_run_id}/artifacts", options
|
28
|
+
end
|
29
|
+
|
30
|
+
# Get an artifact
|
31
|
+
#
|
32
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
33
|
+
# @param id [Integer] Id of an artifact
|
34
|
+
#
|
35
|
+
# @return [Sawyer::Resource] Artifact information
|
36
|
+
# @see https://docs.github.com/en/rest/actions/artifacts#get-an-artifact
|
37
|
+
def artifact(repo, id, options = {})
|
38
|
+
get "#{Repository.path repo}/actions/artifacts/#{id}", options
|
39
|
+
end
|
40
|
+
|
41
|
+
# Get a download URL for an artifact
|
42
|
+
#
|
43
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
44
|
+
# @param id [Integer] Id of an artifact
|
45
|
+
#
|
46
|
+
# @return [String] URL to the .zip archive of the artifact
|
47
|
+
# @see https://docs.github.com/en/rest/actions/artifacts#download-an-artifact
|
48
|
+
def artifact_download_url(repo, id, options = {})
|
49
|
+
url = "#{Repository.path repo}/actions/artifacts/#{id}/zip"
|
50
|
+
|
51
|
+
response = client_without_redirects.head(url, options)
|
52
|
+
response.headers['Location']
|
53
|
+
end
|
54
|
+
|
55
|
+
# Delete an artifact
|
56
|
+
#
|
57
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
58
|
+
# @param id [Integer] Id of an artifact
|
59
|
+
#
|
60
|
+
# @return [Boolean] Return true if the artifact was successfully deleted
|
61
|
+
# @see https://docs.github.com/en/rest/actions/artifacts#delete-an-artifact
|
62
|
+
def delete_artifact(repo, id, options = {})
|
63
|
+
boolean_from_response :delete, "#{Repository.path repo}/actions/artifacts/#{id}", options
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -335,6 +335,27 @@ module Octokit
|
|
335
335
|
get "#{Organization.path(org)}/teams/#{team_slug}", options
|
336
336
|
end
|
337
337
|
|
338
|
+
# Check team permissions for a repository
|
339
|
+
#
|
340
|
+
# Requires authenticated organization member.
|
341
|
+
#
|
342
|
+
# @param org [String, Integer] Organization GitHub login or id.
|
343
|
+
# @param team_slug_or_id [String, Integer] Team slug or Team ID.
|
344
|
+
# @param owner [String] Owner name for the repository.
|
345
|
+
# @param repo [String] Name of the repo to check permissions against.
|
346
|
+
# @return [String, Sawyer::Resource] Depending on options it may be an empty string or a resource.
|
347
|
+
# @example
|
348
|
+
# # Check whether the team has any permissions with the repository
|
349
|
+
# @client.team_permissions_for_repo("github", "justice-league", "octocat", "hello-world")
|
350
|
+
#
|
351
|
+
# @example
|
352
|
+
# # Get the full repository object including the permissions level and role for the team
|
353
|
+
# @client.team_permissions_for_repo("github", "justice-league", "octocat", "hello-world", :accept => 'application/vnd.github.v3.repository+json')
|
354
|
+
# @see https://docs.github.com/en/rest/teams/teams#check-team-permissions-for-a-repository
|
355
|
+
def team_permissions_for_repo(org, team_slug_or_id, owner, repo, options = {})
|
356
|
+
get "#{Organization.path(org)}/teams/#{team_slug_or_id}/repos/#{owner}/#{repo}", options
|
357
|
+
end
|
358
|
+
|
338
359
|
# List child teams
|
339
360
|
#
|
340
361
|
# Requires authenticated organization member.
|
@@ -802,6 +823,26 @@ module Octokit
|
|
802
823
|
def billing_actions(org)
|
803
824
|
get "#{Organization.path(org)}/settings/billing/actions"
|
804
825
|
end
|
826
|
+
|
827
|
+
# Get organization audit log.
|
828
|
+
#
|
829
|
+
# Gets the audit log for an organization.
|
830
|
+
#
|
831
|
+
# @param org [String, Integer] Organization GitHub login or id for which
|
832
|
+
# to retrieve the audit log.
|
833
|
+
# @option options [String] :include ('all') Filter by event type.
|
834
|
+
# `all`, `git` or `web`.
|
835
|
+
# @option options [String] :phrase A search phrase.
|
836
|
+
# @option options [String] :order ('desc') The order of audit log events. To list newest events first, specify desc.
|
837
|
+
# To list oldest events first, specify asc.
|
838
|
+
#
|
839
|
+
# @return [Array<Sawyer::Resource>] List of events
|
840
|
+
# @see https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/orgs#get-the-audit-log-for-an-organization
|
841
|
+
# @example
|
842
|
+
# Octokit.organization_audit_log('github', {include: 'all', phrase: 'action:org.add_member created:>2022-08-29 user:octocat'})
|
843
|
+
def organization_audit_log(org, options = {})
|
844
|
+
paginate "#{Organization.path org}/audit-log", options
|
845
|
+
end
|
805
846
|
end
|
806
847
|
end
|
807
848
|
end
|
data/lib/octokit/client.rb
CHANGED
@@ -11,6 +11,7 @@ require 'octokit/rate_limit'
|
|
11
11
|
require 'octokit/repository'
|
12
12
|
require 'octokit/user'
|
13
13
|
require 'octokit/organization'
|
14
|
+
require 'octokit/client/actions_artifacts'
|
14
15
|
require 'octokit/client/actions_secrets'
|
15
16
|
require 'octokit/client/actions_workflows'
|
16
17
|
require 'octokit/client/actions_workflow_jobs'
|
@@ -74,6 +75,7 @@ module Octokit
|
|
74
75
|
include Octokit::Configurable
|
75
76
|
include Octokit::Connection
|
76
77
|
include Octokit::Warnable
|
78
|
+
include Octokit::Client::ActionsArtifacts
|
77
79
|
include Octokit::Client::ActionsSecrets
|
78
80
|
include Octokit::Client::Authorizations
|
79
81
|
include Octokit::Client::Checks
|
data/lib/octokit/error.rb
CHANGED
@@ -77,7 +77,7 @@ module Octokit
|
|
77
77
|
Octokit::TooManyRequests
|
78
78
|
when /login attempts exceeded/i
|
79
79
|
Octokit::TooManyLoginAttempts
|
80
|
-
when /returns blobs up to [0-9]+ MB/i
|
80
|
+
when /(returns|for) blobs (up to|between) [0-9\-]+ MB/i
|
81
81
|
Octokit::TooLargeContent
|
82
82
|
when /abuse/i
|
83
83
|
Octokit::AbuseDetected
|
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: 5.
|
4
|
+
version: 5.6.1
|
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-09-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- lib/octokit/arguments.rb
|
86
86
|
- lib/octokit/authentication.rb
|
87
87
|
- lib/octokit/client.rb
|
88
|
+
- lib/octokit/client/actions_artifacts.rb
|
88
89
|
- lib/octokit/client/actions_secrets.rb
|
89
90
|
- lib/octokit/client/actions_workflow_jobs.rb
|
90
91
|
- lib/octokit/client/actions_workflow_runs.rb
|