octokit 5.3.0 → 5.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 141fb4f7d19bc08a88ee10f57ef90a92693d9809fd48a456c84d27a420d808ce
4
- data.tar.gz: a1e56cee779f2b90a0241dbc4a36a150e836a77c7f5001d12ded8b4f6c8bc01d
3
+ metadata.gz: bbf0b3ef2f8550628d4bde2fa55f7bcb97261364e94aac9f5a149ce6e86fa019
4
+ data.tar.gz: d336c02e28efb73618c1c24827b2b7703dc5341ce95087467089cf36f11d96fb
5
5
  SHA512:
6
- metadata.gz: 539ba245d6a0e5768b0e5771e2060070c8fbb9e57f22029adbbf5cf9e27e36367194545319842cd6a999b92e7f05746cb910acef767e4f4db4a2c957181cb3e0
7
- data.tar.gz: 95c82a4c3cc174b17a0566cea12dc261dfae703e20a9a1c8478a5704d4d011ec72840883b7d0c2552861e2127d305329f62210401dbbc57672b123b9a11868ae
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", "~> 4.0"
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/plataformatec/faraday-http-cache
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
@@ -4,7 +4,7 @@ module Octokit
4
4
  class Client
5
5
  # Methods for Projects API
6
6
  #
7
- # @see https://developer.github.com/v3/repos/projects
7
+ # @see https://docs.github.com/en/rest/projects
8
8
  module Projects
9
9
  # List projects for a repository
10
10
  #
@@ -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
@@ -7,11 +7,11 @@ module Octokit
7
7
 
8
8
  # Current minor release.
9
9
  # @return [Integer]
10
- MINOR = 3
10
+ MINOR = 6
11
11
 
12
12
  # Current patch level.
13
13
  # @return [Integer]
14
- PATCH = 0
14
+ PATCH = 1
15
15
 
16
16
  # Full release version.
17
17
  # @return [String]
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.3.0
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-08-24 00:00:00.000000000 Z
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