octokit 8.0.0 → 8.1.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/lib/octokit/client/actions_secrets.rb +49 -0
- data/lib/octokit/client/codespaces_secrets.rb +49 -0
- data/lib/octokit/client/dependabot_secrets.rb +49 -0
- data/lib/octokit/client/deployments.rb +2 -2
- data/lib/octokit/client/oauth_applications.rb +1 -1
- data/lib/octokit/client/users.rb +27 -0
- data/lib/octokit/middleware/follow_redirects.rb +1 -1
- data/lib/octokit/version.rb +1 -1
- data/octokit.gemspec +1 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dead7bdb61143c1a0b84afa0b02b567a29e117b0b15e0d0ee10271bb9dc62a17
|
4
|
+
data.tar.gz: 648cb60f5d7f8765f925ec2a673dd00331151d3222b392a9814e856e6d303a67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b5d2d09d0665466a4bdca1d523758ad447db67c911284c2738a311c400267dbbabcf4c92079c83550339b1cd5361abe841a672a89bc77a7345940d3041cee65
|
7
|
+
data.tar.gz: ca2ced14c1bb869c41f94806427fbd16917eadd6486c35c58c69c59c44b384c323b282266ae95b84bd6109674051a963d6b2d1fea15609bbc61c033a55b6e90f
|
@@ -15,6 +15,15 @@ module Octokit
|
|
15
15
|
get "#{Repository.path repo}/actions/secrets/public-key"
|
16
16
|
end
|
17
17
|
|
18
|
+
# Get public key for secrets encryption
|
19
|
+
#
|
20
|
+
# @param org [String] A GitHub organization
|
21
|
+
# @return [Hash] key_id and key
|
22
|
+
# @see https://developer.github.com/v3/actions/secrets/#get-your-public-key
|
23
|
+
def get_org_actions_public_key(org)
|
24
|
+
get "#{Organization.path org}/actions/secrets/public-key"
|
25
|
+
end
|
26
|
+
|
18
27
|
# List secrets
|
19
28
|
#
|
20
29
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
@@ -26,6 +35,17 @@ module Octokit
|
|
26
35
|
end
|
27
36
|
end
|
28
37
|
|
38
|
+
# List org secrets
|
39
|
+
#
|
40
|
+
# @param org [String] A GitHub organization
|
41
|
+
# @return [Hash] total_count and list of secrets (each item is hash with name, created_at and updated_at)
|
42
|
+
# @see https://developer.github.com/v3/actions/secrets/#list-organization-secrets
|
43
|
+
def list_org_actions_secrets(org)
|
44
|
+
paginate "#{Organization.path org}/actions/secrets" do |data, last_response|
|
45
|
+
data.secrets.concat last_response.data.secrets
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
29
49
|
# Get a secret
|
30
50
|
#
|
31
51
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
@@ -36,6 +56,16 @@ module Octokit
|
|
36
56
|
get "#{Repository.path repo}/actions/secrets/#{name}"
|
37
57
|
end
|
38
58
|
|
59
|
+
# Get an org secret
|
60
|
+
#
|
61
|
+
# @param org [String] A GitHub organization
|
62
|
+
# @param name [String] Name of secret
|
63
|
+
# @return [Hash] name, created_at and updated_at
|
64
|
+
# @see https://developer.github.com/v3/actions/secrets/#get-a-secret
|
65
|
+
def get_org_actions_secret(org, name)
|
66
|
+
get "#{Organization.path org}/actions/secrets/#{name}"
|
67
|
+
end
|
68
|
+
|
39
69
|
# Create or update secrets
|
40
70
|
#
|
41
71
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
@@ -46,6 +76,16 @@ module Octokit
|
|
46
76
|
put "#{Repository.path repo}/actions/secrets/#{name}", options
|
47
77
|
end
|
48
78
|
|
79
|
+
# Create or update org secrets
|
80
|
+
#
|
81
|
+
# @param org [String] A GitHub organization
|
82
|
+
# @param name [String] Name of secret
|
83
|
+
# @param options [Hash] encrypted_value and key_id
|
84
|
+
# @see https://developer.github.com/v3/actions/secrets/#create-or-update-a-secret
|
85
|
+
def create_or_update_org_actions_secret(org, name, options)
|
86
|
+
put "#{Organization.path org}/actions/secrets/#{name}", options
|
87
|
+
end
|
88
|
+
|
49
89
|
# Delete a secret
|
50
90
|
#
|
51
91
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
@@ -55,6 +95,15 @@ module Octokit
|
|
55
95
|
boolean_from_response :delete, "#{Repository.path repo}/actions/secrets/#{name}"
|
56
96
|
end
|
57
97
|
|
98
|
+
# Delete an org secret
|
99
|
+
#
|
100
|
+
# @param org [String] A GitHub organization
|
101
|
+
# @param name [String] Name of secret
|
102
|
+
# @see https://developer.github.com/v3/actions/secrets/#delete-a-secret
|
103
|
+
def delete_org_actions_secret(org, name)
|
104
|
+
boolean_from_response :delete, "#{Organization.path org}/actions/secrets/#{name}"
|
105
|
+
end
|
106
|
+
|
58
107
|
# Get environment public key for secrets encryption
|
59
108
|
#
|
60
109
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
@@ -15,6 +15,15 @@ module Octokit
|
|
15
15
|
get "#{Repository.path repo}/codespaces/secrets/public-key"
|
16
16
|
end
|
17
17
|
|
18
|
+
# Get public key for secrets encryption
|
19
|
+
#
|
20
|
+
# @param org [String] A GitHub organization
|
21
|
+
# @return [Hash] key_id and key
|
22
|
+
# @see https://docs.github.com/en/rest/codespaces/organization-secrets?apiVersion=2022-11-28#get-an-organization-public-key
|
23
|
+
def get_org_codespaces_public_key(org)
|
24
|
+
get "#{Organization.path org}/codespaces/secrets/public-key"
|
25
|
+
end
|
26
|
+
|
18
27
|
# List secrets
|
19
28
|
#
|
20
29
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
@@ -26,6 +35,17 @@ module Octokit
|
|
26
35
|
end
|
27
36
|
end
|
28
37
|
|
38
|
+
# List org secrets
|
39
|
+
#
|
40
|
+
# @param org [String] A GitHub organization
|
41
|
+
# @return [Hash] total_count and list of secrets (each item is hash with name, created_at and updated_at)
|
42
|
+
# @see https://docs.github.com/en/rest/codespaces/organization-secrets?apiVersion=2022-11-28#list-organization-secrets
|
43
|
+
def list_org_codespaces_secrets(org)
|
44
|
+
paginate "#{Organization.path org}/codespaces/secrets" do |data, last_response|
|
45
|
+
data.secrets.concat last_response.data.secrets
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
29
49
|
# Get a secret
|
30
50
|
#
|
31
51
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
@@ -36,6 +56,16 @@ module Octokit
|
|
36
56
|
get "#{Repository.path repo}/codespaces/secrets/#{name}"
|
37
57
|
end
|
38
58
|
|
59
|
+
# Get an org secret
|
60
|
+
#
|
61
|
+
# @param org [String] A GitHub organization
|
62
|
+
# @param name [String] Name of secret
|
63
|
+
# @return [Hash] name, created_at, updated_at, and visibility
|
64
|
+
# @see https://docs.github.com/en/rest/codespaces/organization-secrets?apiVersion=2022-11-28#get-an-organization-secret
|
65
|
+
def get_org_codespaces_secret(org, name)
|
66
|
+
get "#{Organization.path org}/codespaces/secrets/#{name}"
|
67
|
+
end
|
68
|
+
|
39
69
|
# Create or update secrets
|
40
70
|
#
|
41
71
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
@@ -46,6 +76,16 @@ module Octokit
|
|
46
76
|
put "#{Repository.path repo}/codespaces/secrets/#{name}", options
|
47
77
|
end
|
48
78
|
|
79
|
+
# Create or update org secrets
|
80
|
+
#
|
81
|
+
# @param org [String] A GitHub organization
|
82
|
+
# @param name [String] Name of secret
|
83
|
+
# @param options [Hash] encrypted_value and key_id
|
84
|
+
# @see https://docs.github.com/en/rest/codespaces/organization-secrets?apiVersion=2022-11-28#create-or-update-an-organization-secret
|
85
|
+
def create_or_update_org_codespaces_secret(org, name, options)
|
86
|
+
put "#{Organization.path org}/codespaces/secrets/#{name}", options
|
87
|
+
end
|
88
|
+
|
49
89
|
# Delete a secret
|
50
90
|
#
|
51
91
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
@@ -54,6 +94,15 @@ module Octokit
|
|
54
94
|
def delete_codespaces_secret(repo, name)
|
55
95
|
boolean_from_response :delete, "#{Repository.path repo}/codespaces/secrets/#{name}"
|
56
96
|
end
|
97
|
+
|
98
|
+
# Delete an org secret
|
99
|
+
#
|
100
|
+
# @param org [String] A GitHub organization
|
101
|
+
# @param name [String] Name of secret
|
102
|
+
# @see https://docs.github.com/en/rest/codespaces/organization-secrets?apiVersion=2022-11-28#delete-an-organization-secret
|
103
|
+
def delete_org_codespaces_secret(org, name)
|
104
|
+
boolean_from_response :delete, "#{Organization.path org}/codespaces/secrets/#{name}"
|
105
|
+
end
|
57
106
|
end
|
58
107
|
end
|
59
108
|
end
|
@@ -15,6 +15,15 @@ module Octokit
|
|
15
15
|
get "#{Repository.path repo}/dependabot/secrets/public-key"
|
16
16
|
end
|
17
17
|
|
18
|
+
# Get public key for secrets encryption
|
19
|
+
#
|
20
|
+
# @param org [String] A GitHub organization
|
21
|
+
# @return [Hash] key_id and key
|
22
|
+
# @see https://docs.github.com/en/rest/dependabot/organization-secrets?apiVersion=2022-11-28#get-an-organization-public-key
|
23
|
+
def get_org_dependabot_public_key(org)
|
24
|
+
get "#{Organization.path org}/dependabot/secrets/public-key"
|
25
|
+
end
|
26
|
+
|
18
27
|
# List secrets
|
19
28
|
#
|
20
29
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
@@ -26,6 +35,17 @@ module Octokit
|
|
26
35
|
end
|
27
36
|
end
|
28
37
|
|
38
|
+
# List org secrets
|
39
|
+
#
|
40
|
+
# @param org [String] A GitHub organization
|
41
|
+
# @return [Hash] total_count and list of secrets (each item is hash with name, created_at and updated_at)
|
42
|
+
# @see https://docs.github.com/en/rest/dependabot/organization-secrets?apiVersion=2022-11-28#list-organization-secrets
|
43
|
+
def list_org_dependabot_secrets(org)
|
44
|
+
paginate "#{Organization.path org}/dependabot/secrets" do |data, last_response|
|
45
|
+
data.secrets.concat last_response.data.secrets
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
29
49
|
# Get a secret
|
30
50
|
#
|
31
51
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
@@ -36,6 +56,16 @@ module Octokit
|
|
36
56
|
get "#{Repository.path repo}/dependabot/secrets/#{name}"
|
37
57
|
end
|
38
58
|
|
59
|
+
# Get an org secret
|
60
|
+
#
|
61
|
+
# @param org [String] A GitHub organization
|
62
|
+
# @param name [String] Name of secret
|
63
|
+
# @return [Hash] name, created_at, updated_at, and visibility
|
64
|
+
# @see https://docs.github.com/en/rest/dependabot/organization-secrets?apiVersion=2022-11-28#get-an-organization-secret
|
65
|
+
def get_org_dependabot_secret(org, name)
|
66
|
+
get "#{Organization.path org}/dependabot/secrets/#{name}"
|
67
|
+
end
|
68
|
+
|
39
69
|
# Create or update secrets
|
40
70
|
#
|
41
71
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
@@ -46,6 +76,16 @@ module Octokit
|
|
46
76
|
put "#{Repository.path repo}/dependabot/secrets/#{name}", options
|
47
77
|
end
|
48
78
|
|
79
|
+
# Create or update org secrets
|
80
|
+
#
|
81
|
+
# @param org [String] A GitHub organization
|
82
|
+
# @param name [String] Name of secret
|
83
|
+
# @param options [Hash] encrypted_value and key_id
|
84
|
+
# @see https://docs.github.com/en/rest/dependabot/organization-secrets?apiVersion=2022-11-28#create-or-update-an-organization-secret
|
85
|
+
def create_or_update_org_dependabot_secret(org, name, options)
|
86
|
+
put "#{Organization.path org}/dependabot/secrets/#{name}", options
|
87
|
+
end
|
88
|
+
|
49
89
|
# Delete a secret
|
50
90
|
#
|
51
91
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
@@ -54,6 +94,15 @@ module Octokit
|
|
54
94
|
def delete_dependabot_secret(repo, name)
|
55
95
|
boolean_from_response :delete, "#{Repository.path repo}/dependabot/secrets/#{name}"
|
56
96
|
end
|
97
|
+
|
98
|
+
# Delete an org secret
|
99
|
+
#
|
100
|
+
# @param org [String] A GitHub organization
|
101
|
+
# @param name [String] Name of secret
|
102
|
+
# @see https://docs.github.com/en/rest/dependabot/organization-secrets?apiVersion=2022-11-28#delete-an-organization-secret
|
103
|
+
def delete_org_dependabot_secret(org, name)
|
104
|
+
boolean_from_response :delete, "#{Organization.path org}/dependabot/secrets/#{name}"
|
105
|
+
end
|
57
106
|
end
|
58
107
|
end
|
59
108
|
end
|
@@ -22,7 +22,7 @@ module Octokit
|
|
22
22
|
# @return [Array<Sawyer::Resource>] A list of deployments
|
23
23
|
# @see https://developer.github.com/v3/repos/deployments/#list-deployments
|
24
24
|
def deployments(repo, options = {})
|
25
|
-
|
25
|
+
paginate("#{Repository.path repo}/deployments", options)
|
26
26
|
end
|
27
27
|
alias list_deployments deployments
|
28
28
|
|
@@ -60,7 +60,7 @@ module Octokit
|
|
60
60
|
# @see https://developer.github.com/v3/repos/deployments/#list-deployment-statuses
|
61
61
|
def deployment_statuses(deployment_url, options = {})
|
62
62
|
deployment = get(deployment_url, accept: options[:accept])
|
63
|
-
|
63
|
+
paginate(deployment.rels[:statuses].href, options)
|
64
64
|
end
|
65
65
|
alias list_deployment_statuses deployment_statuses
|
66
66
|
|
@@ -65,7 +65,7 @@ module Octokit
|
|
65
65
|
#
|
66
66
|
# @example
|
67
67
|
# client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
|
68
|
-
# client.
|
68
|
+
# client.delete_app_token('deadbeef1234567890deadbeef987654321')
|
69
69
|
def delete_app_token(access_token, options = {})
|
70
70
|
options[:access_token] = access_token
|
71
71
|
|
data/lib/octokit/client/users.rb
CHANGED
@@ -57,6 +57,33 @@ module Octokit
|
|
57
57
|
post "#{web_endpoint}login/oauth/access_token", options
|
58
58
|
end
|
59
59
|
|
60
|
+
# Refresh a user's access token with a refresh token.
|
61
|
+
#
|
62
|
+
# Applications can refresh an access token without requiring a user to re-authorize using refresh access token.
|
63
|
+
#
|
64
|
+
# @param code [String] 40 character GitHub OAuth refresh access token
|
65
|
+
#
|
66
|
+
# @return [Sawyer::Resource]
|
67
|
+
# @see https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/refreshing-user-access-tokens#refreshing-a-user-access-token-with-a-refresh-token
|
68
|
+
#
|
69
|
+
# @example
|
70
|
+
# client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
|
71
|
+
# client.refresh_access_token('40-character-refresh-token')
|
72
|
+
def refresh_access_token(code, app_id = client_id, app_secret = client_secret, options = {})
|
73
|
+
options = options.merge({
|
74
|
+
refresh_token: code,
|
75
|
+
client_id: app_id,
|
76
|
+
client_secret: app_secret,
|
77
|
+
grant_type: 'refresh_token',
|
78
|
+
headers: {
|
79
|
+
content_type: 'application/json',
|
80
|
+
accept: 'application/json'
|
81
|
+
}
|
82
|
+
})
|
83
|
+
|
84
|
+
post "#{web_endpoint}login/oauth/access_token", options
|
85
|
+
end
|
86
|
+
|
60
87
|
# Validate user username and password
|
61
88
|
#
|
62
89
|
# @param options [Hash] User credentials
|
data/lib/octokit/version.rb
CHANGED
data/octokit.gemspec
CHANGED
@@ -5,6 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
require 'octokit/version'
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
|
+
spec.add_dependency 'base64'
|
8
9
|
spec.add_dependency 'faraday', '>= 1', '< 3'
|
9
10
|
spec.add_dependency 'sawyer', '~> 0.9'
|
10
11
|
spec.authors = ['Wynn Netherland', 'Erik Michaels-Ober', 'Clint Shryock']
|
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: 8.
|
4
|
+
version: 8.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wynn Netherland
|
@@ -10,8 +10,22 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-02-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: base64
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '0'
|
15
29
|
- !ruby/object:Gem::Dependency
|
16
30
|
name: faraday
|
17
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -167,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
181
|
- !ruby/object:Gem::Version
|
168
182
|
version: 1.3.5
|
169
183
|
requirements: []
|
170
|
-
rubygems_version: 3.4.
|
184
|
+
rubygems_version: 3.4.20
|
171
185
|
signing_key:
|
172
186
|
specification_version: 4
|
173
187
|
summary: Ruby toolkit for working with the GitHub API
|