octokit 4.25.1 → 6.0.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/README.md +5 -4
- data/lib/octokit/client/actions_artifacts.rb +71 -0
- data/lib/octokit/client/actions_secrets.rb +3 -1
- data/lib/octokit/client/actions_workflow_jobs.rb +65 -0
- data/lib/octokit/client/actions_workflow_runs.rb +21 -3
- data/lib/octokit/client/actions_workflows.rb +25 -1
- data/lib/octokit/client/apps.rb +15 -15
- data/lib/octokit/client/community_profile.rb +0 -1
- data/lib/octokit/client/events.rb +0 -1
- data/lib/octokit/client/hooks.rb +0 -10
- data/lib/octokit/client/issues.rb +0 -1
- data/lib/octokit/client/licenses.rb +0 -3
- data/lib/octokit/client/oauth_applications.rb +0 -4
- data/lib/octokit/client/organizations.rb +41 -13
- data/lib/octokit/client/pages.rb +2 -4
- data/lib/octokit/client/projects.rb +26 -45
- data/lib/octokit/client/pub_sub_hubbub.rb +7 -7
- data/lib/octokit/client/pull_requests.rb +11 -0
- data/lib/octokit/client/reactions.rb +4 -9
- data/lib/octokit/client/refs.rb +1 -3
- data/lib/octokit/client/repositories.rb +13 -33
- data/lib/octokit/client/reviews.rb +2 -2
- data/lib/octokit/client/search.rb +14 -1
- data/lib/octokit/client/source_import.rb +3 -8
- data/lib/octokit/client/tokens.rb +31 -0
- data/lib/octokit/client/traffic.rb +4 -8
- data/lib/octokit/client/users.rb +0 -7
- data/lib/octokit/client.rb +6 -4
- data/lib/octokit/configurable.rb +2 -4
- data/lib/octokit/connection.rb +1 -1
- data/lib/octokit/default.rb +18 -18
- data/lib/octokit/error.rb +21 -14
- data/lib/octokit/middleware/follow_redirects.rb +1 -1
- data/lib/octokit/rate_limit.rb +1 -1
- data/lib/octokit/repository.rb +1 -0
- data/lib/octokit/version.rb +3 -3
- data/octokit.gemspec +1 -1
- metadata +10 -9
- data/lib/octokit/client/authorizations.rb +0 -185
- data/lib/octokit/preview.rb +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3018cabf6ab75fe3a4340d20a4844ab92fa7059a4bbbdd96b9b671537aef5b5
|
4
|
+
data.tar.gz: 6308252f312bb301eadfe573daf9d5e17ce0698480dbdc938f72b62831e73632
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7477cd6b438fedbec3fe952a8aebeefa224b991a65c8950c26c938db69962614d1ae066c3afd4b40a37ab935637af2dbc08ae126f8e5d199c16df1e646b2878b
|
7
|
+
data.tar.gz: 6d891d836aa8118c9cce64d265ee26d8e97f7dc05425d491d0d7123f1b9fab12eb3aa62ccc85a1b69640ed29819dba7b19d34161f2fa5b159a0b36701c0c758a
|
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Octokit
|
2
2
|
|
3
|
+
> **Note**
|
4
|
+
> We've recently renamed the `4-stable` branch to `main`. This might affect you if you're making changes to Octokit's code locally. For more details and for the steps to reconfigure your local clone for the new branch name, check out [this post](https://github.com/octokit/octokit.rb/discussions/1455).
|
5
|
+
|
3
6
|
Ruby toolkit for the GitHub API.
|
4
7
|
|
5
8
|

|
@@ -76,7 +79,7 @@ Install via Rubygems
|
|
76
79
|
|
77
80
|
... or add to your Gemfile
|
78
81
|
|
79
|
-
gem "octokit", "~>
|
82
|
+
gem "octokit", "~> 5.0"
|
80
83
|
|
81
84
|
Access the library in Ruby:
|
82
85
|
|
@@ -661,7 +664,7 @@ Once configured, the middleware will store responses in cache based on ETag
|
|
661
664
|
fingerprint and serve those back up for future `304` responses for the same
|
662
665
|
resource. See the [project README][cache] for advanced usage.
|
663
666
|
|
664
|
-
[cache]: https://github.com/
|
667
|
+
[cache]: https://github.com/sourcelevel/faraday-http-cache
|
665
668
|
[faraday]: https://github.com/lostisland/faraday
|
666
669
|
|
667
670
|
## Hacking on Octokit.rb
|
@@ -740,8 +743,6 @@ when writing new specs.
|
|
740
743
|
This library aims to support and is [tested against][actions] the following Ruby
|
741
744
|
implementations:
|
742
745
|
|
743
|
-
* Ruby 2.5
|
744
|
-
* Ruby 2.6
|
745
746
|
* Ruby 2.7
|
746
747
|
* Ruby 3.0
|
747
748
|
* Ruby 3.1
|
@@ -0,0 +1,71 @@
|
|
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 do |data, last_response|
|
17
|
+
data.artifacts.concat last_response.data.artifacts
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# List all artifacts for a workflow run
|
22
|
+
#
|
23
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
24
|
+
# @param workflow_run_id [Integer] Id of a workflow run
|
25
|
+
#
|
26
|
+
# @return [Sawyer::Resource] the total count and an array of artifacts
|
27
|
+
# @see https://docs.github.com/en/rest/actions/artifacts#list-workflow-run-artifacts
|
28
|
+
def workflow_run_artifacts(repo, workflow_run_id, options = {})
|
29
|
+
paginate "#{Repository.path repo}/actions/runs/#{workflow_run_id}/artifacts", options do |data, last_response|
|
30
|
+
data.artifacts.concat last_response.data.artifacts
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# Get an artifact
|
35
|
+
#
|
36
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
37
|
+
# @param id [Integer] Id of an artifact
|
38
|
+
#
|
39
|
+
# @return [Sawyer::Resource] Artifact information
|
40
|
+
# @see https://docs.github.com/en/rest/actions/artifacts#get-an-artifact
|
41
|
+
def artifact(repo, id, options = {})
|
42
|
+
get "#{Repository.path repo}/actions/artifacts/#{id}", options
|
43
|
+
end
|
44
|
+
|
45
|
+
# Get a download URL for an artifact
|
46
|
+
#
|
47
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
48
|
+
# @param id [Integer] Id of an artifact
|
49
|
+
#
|
50
|
+
# @return [String] URL to the .zip archive of the artifact
|
51
|
+
# @see https://docs.github.com/en/rest/actions/artifacts#download-an-artifact
|
52
|
+
def artifact_download_url(repo, id, options = {})
|
53
|
+
url = "#{Repository.path repo}/actions/artifacts/#{id}/zip"
|
54
|
+
|
55
|
+
response = client_without_redirects.head(url, options)
|
56
|
+
response.headers['Location']
|
57
|
+
end
|
58
|
+
|
59
|
+
# Delete an artifact
|
60
|
+
#
|
61
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
62
|
+
# @param id [Integer] Id of an artifact
|
63
|
+
#
|
64
|
+
# @return [Boolean] Return true if the artifact was successfully deleted
|
65
|
+
# @see https://docs.github.com/en/rest/actions/artifacts#delete-an-artifact
|
66
|
+
def delete_artifact(repo, id, options = {})
|
67
|
+
boolean_from_response :delete, "#{Repository.path repo}/actions/artifacts/#{id}", options
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -21,7 +21,9 @@ module Octokit
|
|
21
21
|
# @return [Hash] total_count and list of secrets (each item is hash with name, created_at and updated_at)
|
22
22
|
# @see https://developer.github.com/v3/actions/secrets/#list-secrets-for-a-repository
|
23
23
|
def list_secrets(repo)
|
24
|
-
paginate "#{Repository.path repo}/actions/secrets"
|
24
|
+
paginate "#{Repository.path repo}/actions/secrets" do |data, last_response|
|
25
|
+
data.secrets.concat last_response.data.secrets
|
26
|
+
end
|
25
27
|
end
|
26
28
|
|
27
29
|
# Get a secret
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Octokit
|
4
|
+
class Client
|
5
|
+
# Methods for the Actions Workflows jobs API
|
6
|
+
#
|
7
|
+
# @see https://docs.github.com/rest/actions/workflow-jobs
|
8
|
+
module ActionsWorkflowJobs
|
9
|
+
# Get a job for a workflow run
|
10
|
+
#
|
11
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
12
|
+
# @param job_id [Integer, String] Id of the job
|
13
|
+
#
|
14
|
+
# @return [Sawyer::Resource] Job information
|
15
|
+
# @see https://docs.github.com/rest/actions/workflow-jobs#get-a-job-for-a-workflow-run
|
16
|
+
def workflow_run_job(repo, job_id, options = {})
|
17
|
+
get "#{Repository.path repo}/actions/jobs/#{job_id}", options
|
18
|
+
end
|
19
|
+
|
20
|
+
# Download job logs for a workflow run
|
21
|
+
#
|
22
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
23
|
+
# @param job_id [Integer, String] Id of the job
|
24
|
+
#
|
25
|
+
# @return [String] URL to the archived log files of the job
|
26
|
+
# @see https://docs.github.com/rest/actions/workflow-jobs#download-job-logs-for-a-workflow-run
|
27
|
+
def workflow_run_job_logs(repo, job_id, options = {})
|
28
|
+
url = "#{Repository.path repo}/actions/jobs/#{job_id}/logs"
|
29
|
+
|
30
|
+
response = client_without_redirects.head(url, options)
|
31
|
+
response.headers['Location']
|
32
|
+
end
|
33
|
+
|
34
|
+
# List jobs for a workflow run attempt
|
35
|
+
#
|
36
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
37
|
+
# @param run_id [Integer, String] Id of the workflow run
|
38
|
+
# @param attempt_number [Integer, String] Attempt number of the workflow run
|
39
|
+
#
|
40
|
+
# @return [Sawyer::Resource] Jobs information
|
41
|
+
# @see https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run-attempt
|
42
|
+
def workflow_run_attempt_jobs(repo, run_id, attempt_number, options = {})
|
43
|
+
paginate "#{Repository.path repo}/actions/runs/#{run_id}/attempts/#{attempt_number}/jobs", options do |data, last_response|
|
44
|
+
data.jobs.concat last_response.data.jobs
|
45
|
+
end
|
46
|
+
end
|
47
|
+
alias list_workflow_run_attempt_jobs workflow_run_attempt_jobs
|
48
|
+
|
49
|
+
# List jobs for a workflow run
|
50
|
+
#
|
51
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
52
|
+
# @param run_id [Integer, String] Id of the workflow run
|
53
|
+
# @option options [String] :filter Optional filtering by a `completed_at` timestamp
|
54
|
+
#
|
55
|
+
# @return [Sawyer::Resource] Jobs information
|
56
|
+
# @see https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run
|
57
|
+
def workflow_run_jobs(repo, run_id, options = {})
|
58
|
+
paginate "#{Repository.path repo}/actions/runs/#{run_id}/jobs", options do |data, last_response|
|
59
|
+
data.jobs.concat last_response.data.jobs
|
60
|
+
end
|
61
|
+
end
|
62
|
+
alias list_workflow_run_jobs workflow_run_jobs
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
module Octokit
|
4
4
|
class Client
|
5
|
+
# Methods for the Actions Workflows runs API
|
6
|
+
#
|
7
|
+
# @see https://docs.github.com/rest/actions/workflow-runs
|
5
8
|
module ActionsWorkflowRuns
|
6
9
|
# List all runs for a repository workflow
|
7
10
|
#
|
@@ -15,7 +18,9 @@ module Octokit
|
|
15
18
|
# @return [Sawyer::Resource] the total count and an array of workflows
|
16
19
|
# @see https://developer.github.com/v3/actions/workflow-runs/#list-workflow-runs
|
17
20
|
def workflow_runs(repo, workflow, options = {})
|
18
|
-
paginate "#{Repository.path repo}/actions/workflows/#{workflow}/runs", options
|
21
|
+
paginate "#{Repository.path repo}/actions/workflows/#{workflow}/runs", options do |data, last_response|
|
22
|
+
data.workflow_runs.concat last_response.data.workflow_runs
|
23
|
+
end
|
19
24
|
end
|
20
25
|
alias list_workflow_runs workflow_runs
|
21
26
|
|
@@ -30,7 +35,9 @@ module Octokit
|
|
30
35
|
# @return [Sawyer::Resource] the total count and an array of workflows
|
31
36
|
# @see https://developer.github.com/v3/actions/workflow-runs/#list-repository-workflow-runs
|
32
37
|
def repository_workflow_runs(repo, options = {})
|
33
|
-
paginate "#{Repository.path repo}/actions/runs", options
|
38
|
+
paginate "#{Repository.path repo}/actions/runs", options do |data, last_response|
|
39
|
+
data.workflow_runs.concat last_response.data.workflow_runs
|
40
|
+
end
|
34
41
|
end
|
35
42
|
alias list_repository_workflow_runs repository_workflow_runs
|
36
43
|
|
@@ -92,7 +99,7 @@ module Octokit
|
|
92
99
|
response.headers['Location']
|
93
100
|
end
|
94
101
|
|
95
|
-
#
|
102
|
+
# Delete all log files of a workflow run
|
96
103
|
#
|
97
104
|
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
98
105
|
# @param id [Integer] Id of a workflow run
|
@@ -102,6 +109,17 @@ module Octokit
|
|
102
109
|
def delete_workflow_run_logs(repo, id, options = {})
|
103
110
|
boolean_from_response :delete, "#{Repository.path repo}/actions/runs/#{id}/logs", options
|
104
111
|
end
|
112
|
+
|
113
|
+
# Get workflow run usage
|
114
|
+
#
|
115
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
116
|
+
# @param id [Integer] Id of a workflow run
|
117
|
+
#
|
118
|
+
# @return [Sawyer::Resource] Run usage
|
119
|
+
# @see https://developer.github.com/v3/actions/workflow-runs/#get-workflow-run-usage
|
120
|
+
def workflow_run_usage(repo, id, options = {})
|
121
|
+
get "#{Repository.path repo}/actions/runs/#{id}/timing", options
|
122
|
+
end
|
105
123
|
end
|
106
124
|
end
|
107
125
|
end
|
@@ -13,7 +13,9 @@ module Octokit
|
|
13
13
|
# @return [Sawyer::Resource] the total count and an array of workflows
|
14
14
|
# @see https://developer.github.com/v3/actions/workflows/#list-repository-workflows
|
15
15
|
def workflows(repo, options = {})
|
16
|
-
paginate "#{Repository.path repo}/actions/workflows", options
|
16
|
+
paginate "#{Repository.path repo}/actions/workflows", options do |data, last_response|
|
17
|
+
data.workflows.concat last_response.data.workflows
|
18
|
+
end
|
17
19
|
end
|
18
20
|
alias list_workflows workflows
|
19
21
|
|
@@ -39,6 +41,28 @@ module Octokit
|
|
39
41
|
def workflow_dispatch(repo, id, ref, options = {})
|
40
42
|
boolean_from_response :post, "#{Repository.path repo}/actions/workflows/#{id}/dispatches", options.merge({ ref: ref })
|
41
43
|
end
|
44
|
+
|
45
|
+
# Enable a workflow
|
46
|
+
#
|
47
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
48
|
+
# @param id [Integer, String] Id or file name of the workflow
|
49
|
+
#
|
50
|
+
# @return [Boolean] True if workflow was enabled, false otherwise
|
51
|
+
# @see https://docs.github.com/en/rest/actions/workflows#enable-a-workflow
|
52
|
+
def workflow_enable(repo, id, options = {})
|
53
|
+
boolean_from_response :put, "#{Repository.path repo}/actions/workflows/#{id}/enable", options
|
54
|
+
end
|
55
|
+
|
56
|
+
# Disable a workflow
|
57
|
+
#
|
58
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
59
|
+
# @param id [Integer, String] Id or file name of the workflow
|
60
|
+
#
|
61
|
+
# @return [Boolean] True if workflow was disabled, false otherwise
|
62
|
+
# @see https://docs.github.com/en/rest/actions/workflows#disable-a-workflow
|
63
|
+
def workflow_disable(repo, id, options = {})
|
64
|
+
boolean_from_response :put, "#{Repository.path repo}/actions/workflows/#{id}/disable", options
|
65
|
+
end
|
42
66
|
end
|
43
67
|
end
|
44
68
|
end
|
data/lib/octokit/client/apps.rb
CHANGED
@@ -29,9 +29,9 @@ module Octokit
|
|
29
29
|
|
30
30
|
def find_integration_installations(options = {})
|
31
31
|
octokit_warn(
|
32
|
-
'Deprecated: Octokit::Client::Apps#find_integration_installations '\
|
33
|
-
'method is deprecated. Please update your call to use '\
|
34
|
-
'Octokit::Client::Apps#find_app_installations before the next major '\
|
32
|
+
'Deprecated: Octokit::Client::Apps#find_integration_installations ' \
|
33
|
+
'method is deprecated. Please update your call to use ' \
|
34
|
+
'Octokit::Client::Apps#find_app_installations before the next major ' \
|
35
35
|
'Octokit version update.'
|
36
36
|
)
|
37
37
|
find_app_installations(options)
|
@@ -76,9 +76,9 @@ module Octokit
|
|
76
76
|
|
77
77
|
def create_integration_installation_access_token(installation, options = {})
|
78
78
|
octokit_warn(
|
79
|
-
'Deprecated: Octokit::Client::Apps#create_integration_installation_access_token '\
|
80
|
-
'method is deprecated. Please update your call to use '\
|
81
|
-
'Octokit::Client::Apps#create_app_installation_access_token before the next major '\
|
79
|
+
'Deprecated: Octokit::Client::Apps#create_integration_installation_access_token ' \
|
80
|
+
'method is deprecated. Please update your call to use ' \
|
81
|
+
'Octokit::Client::Apps#create_app_installation_access_token before the next major ' \
|
82
82
|
'Octokit version update.'
|
83
83
|
)
|
84
84
|
create_app_installation_access_token(installation, options)
|
@@ -136,9 +136,9 @@ module Octokit
|
|
136
136
|
|
137
137
|
def list_integration_installation_repositories(options = {})
|
138
138
|
octokit_warn(
|
139
|
-
'Deprecated: Octokit::Client::Apps#list_integration_installation_repositories '\
|
140
|
-
'method is deprecated. Please update your call to use '\
|
141
|
-
'Octokit::Client::Apps#list_app_installation_repositories before the next major '\
|
139
|
+
'Deprecated: Octokit::Client::Apps#list_integration_installation_repositories ' \
|
140
|
+
'method is deprecated. Please update your call to use ' \
|
141
|
+
'Octokit::Client::Apps#list_app_installation_repositories before the next major ' \
|
142
142
|
'Octokit version update.'
|
143
143
|
)
|
144
144
|
list_app_installation_repositories(options)
|
@@ -160,9 +160,9 @@ module Octokit
|
|
160
160
|
|
161
161
|
def add_repository_to_integration_installation(installation, repo, options = {})
|
162
162
|
octokit_warn(
|
163
|
-
'Deprecated: Octokit::Client::Apps#add_repository_to_integration_installation '\
|
164
|
-
'method is deprecated. Please update your call to use '\
|
165
|
-
'Octokit::Client::Apps#add_repository_to_app_installation before the next major '\
|
163
|
+
'Deprecated: Octokit::Client::Apps#add_repository_to_integration_installation ' \
|
164
|
+
'method is deprecated. Please update your call to use ' \
|
165
|
+
'Octokit::Client::Apps#add_repository_to_app_installation before the next major ' \
|
166
166
|
'Octokit version update.'
|
167
167
|
)
|
168
168
|
add_repository_to_app_installation(installation, repo, options)
|
@@ -184,9 +184,9 @@ module Octokit
|
|
184
184
|
|
185
185
|
def remove_repository_from_integration_installation(installation, repo, options = {})
|
186
186
|
octokit_warn(
|
187
|
-
'Deprecated: Octokit::Client::Apps#remove_repository_from_integration_installation '\
|
188
|
-
'method is deprecated. Please update your call to use '\
|
189
|
-
'Octokit::Client::Apps#remove_repository_from_app_installation before the next major '\
|
187
|
+
'Deprecated: Octokit::Client::Apps#remove_repository_from_integration_installation ' \
|
188
|
+
'method is deprecated. Please update your call to use ' \
|
189
|
+
'Octokit::Client::Apps#remove_repository_from_app_installation before the next major ' \
|
190
190
|
'Octokit version update.'
|
191
191
|
)
|
192
192
|
remove_repository_from_app_installation(installation, repo, options)
|
@@ -14,7 +14,6 @@ module Octokit
|
|
14
14
|
# @example Get community profile metrics for octokit/octokit.rb
|
15
15
|
# @client.community_profile('octokit/octokit.rb')
|
16
16
|
def community_profile(repo, options = {})
|
17
|
-
options = ensure_api_media_type(:community_profile, options)
|
18
17
|
get "#{Repository.path repo}/community/profile", options
|
19
18
|
end
|
20
19
|
end
|
@@ -131,7 +131,6 @@ module Octokit
|
|
131
131
|
# @example List all issues events for issue #38 on octokit/octokit.rb
|
132
132
|
# Octokit.issue_events("octokit/octokit.rb", 38)
|
133
133
|
def issue_events(repo, number, options = {})
|
134
|
-
options = ensure_api_media_type(:project_card_events, options)
|
135
134
|
paginate "#{Repository.path repo}/issues/#{number}/events", options
|
136
135
|
end
|
137
136
|
|
data/lib/octokit/client/hooks.rb
CHANGED
@@ -4,16 +4,6 @@ module Octokit
|
|
4
4
|
class Client
|
5
5
|
# Methods for the Hooks API
|
6
6
|
module Hooks
|
7
|
-
# List all Service Hooks supported by GitHub
|
8
|
-
#
|
9
|
-
# @return [Sawyer::Resource] A list of all hooks on GitHub
|
10
|
-
# @see https://developer.github.com/v3/repos/hooks/#services
|
11
|
-
# @example List all hooks
|
12
|
-
# Octokit.available_hooks
|
13
|
-
def available_hooks(options = {})
|
14
|
-
get 'hooks', options
|
15
|
-
end
|
16
|
-
|
17
7
|
# List repo hooks
|
18
8
|
#
|
19
9
|
# Requires authenticated client.
|
@@ -318,7 +318,6 @@ module Octokit
|
|
318
318
|
# @example Get timeline for issue #1435 on octokit/octokit.rb
|
319
319
|
# Octokit.issue_timeline("octokit/octokit.rb", 1435)
|
320
320
|
def issue_timeline(repo, number, options = {})
|
321
|
-
options = ensure_api_media_type(:issue_timelines, options)
|
322
321
|
paginate "#{Repository.path repo}/issues/#{number}/timeline", options
|
323
322
|
end
|
324
323
|
|
@@ -12,7 +12,6 @@ module Octokit
|
|
12
12
|
# @example
|
13
13
|
# Octokit.licenses
|
14
14
|
def licenses(options = {})
|
15
|
-
options = ensure_api_media_type(:licenses, options)
|
16
15
|
paginate 'licenses', options
|
17
16
|
end
|
18
17
|
|
@@ -24,7 +23,6 @@ module Octokit
|
|
24
23
|
# @example
|
25
24
|
# Octokit.license 'mit'
|
26
25
|
def license(license_name, options = {})
|
27
|
-
options = ensure_api_media_type(:licenses, options)
|
28
26
|
get "licenses/#{license_name}", options
|
29
27
|
end
|
30
28
|
|
@@ -37,7 +35,6 @@ module Octokit
|
|
37
35
|
# @example
|
38
36
|
# Octokit.repository_license_contents 'benbalter/licensee'
|
39
37
|
def repository_license_contents(repo, options = {})
|
40
|
-
options = ensure_api_media_type(:licenses, options)
|
41
38
|
get "#{Repository.path repo}/license", options
|
42
39
|
end
|
43
40
|
end
|
@@ -19,7 +19,6 @@ module Octokit
|
|
19
19
|
# client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
|
20
20
|
# client.check_token('deadbeef1234567890deadbeef987654321')
|
21
21
|
def check_token(access_token, options = {})
|
22
|
-
options = ensure_api_media_type(:applications_api, options.dup)
|
23
22
|
options[:access_token] = access_token
|
24
23
|
|
25
24
|
key = options.delete(:client_id) || client_id
|
@@ -44,7 +43,6 @@ module Octokit
|
|
44
43
|
# client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
|
45
44
|
# client.reset_token('deadbeef1234567890deadbeef987654321')
|
46
45
|
def reset_token(access_token, options = {})
|
47
|
-
options = ensure_api_media_type(:applications_api, options.dup)
|
48
46
|
options[:access_token] = access_token
|
49
47
|
|
50
48
|
key = options.delete(:client_id) || client_id
|
@@ -69,7 +67,6 @@ module Octokit
|
|
69
67
|
# client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
|
70
68
|
# client.delete_token('deadbeef1234567890deadbeef987654321')
|
71
69
|
def delete_app_token(access_token, options = {})
|
72
|
-
options = ensure_api_media_type(:applications_api, options.dup)
|
73
70
|
options[:access_token] = access_token
|
74
71
|
|
75
72
|
key = options.delete(:client_id) || client_id
|
@@ -100,7 +97,6 @@ module Octokit
|
|
100
97
|
# client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
|
101
98
|
# client.delete_app_authorization('deadbeef1234567890deadbeef987654321')
|
102
99
|
def delete_app_authorization(access_token, options = {})
|
103
|
-
options = ensure_api_media_type(:applications_api, options.dup)
|
104
100
|
options[:access_token] = access_token
|
105
101
|
|
106
102
|
key = options.delete(:client_id) || client_id
|
@@ -305,9 +305,6 @@ module Octokit
|
|
305
305
|
if options.key?(:permission)
|
306
306
|
octokit_warn 'Deprecated: Passing :permission option to #create_team. Assign team repository permission by passing :permission to #add_team_repository instead.'
|
307
307
|
end
|
308
|
-
if options.key?(:parent_team_id)
|
309
|
-
options = ensure_api_media_type(:nested_teams, options)
|
310
|
-
end
|
311
308
|
post "#{Organization.path org}/teams", options
|
312
309
|
end
|
313
310
|
|
@@ -338,6 +335,27 @@ module Octokit
|
|
338
335
|
get "#{Organization.path(org)}/teams/#{team_slug}", options
|
339
336
|
end
|
340
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
|
+
|
341
359
|
# List child teams
|
342
360
|
#
|
343
361
|
# Requires authenticated organization member.
|
@@ -348,7 +366,6 @@ module Octokit
|
|
348
366
|
# @example
|
349
367
|
# @client.child_teams(100000, :accept => "application/vnd.github.hellcat-preview+json")
|
350
368
|
def child_teams(team_id, options = {})
|
351
|
-
options = ensure_api_media_type(:nested_teams, options)
|
352
369
|
paginate "teams/#{team_id}/teams", options
|
353
370
|
end
|
354
371
|
|
@@ -372,9 +389,6 @@ module Octokit
|
|
372
389
|
# :permission => 'push'
|
373
390
|
# })
|
374
391
|
def update_team(team_id, options = {})
|
375
|
-
if options.key?(:parent_team_id)
|
376
|
-
options = ensure_api_media_type(:nested_teams, options)
|
377
|
-
end
|
378
392
|
patch "teams/#{team_id}", options
|
379
393
|
end
|
380
394
|
|
@@ -733,7 +747,6 @@ module Octokit
|
|
733
747
|
# @client.start_migration('github', ['github/dotfiles'])
|
734
748
|
# @see https://docs.github.com/en/rest/reference/migrations#start-an-organization-migration
|
735
749
|
def start_migration(org, repositories, options = {})
|
736
|
-
options = ensure_api_media_type(:migrations, options)
|
737
750
|
options[:repositories] = repositories
|
738
751
|
post "#{Organization.path(org)}/migrations", options
|
739
752
|
end
|
@@ -746,7 +759,6 @@ module Octokit
|
|
746
759
|
# @return [Array<Sawyer::Resource>] Array of migration resources.
|
747
760
|
# @see https://docs.github.com/en/rest/reference/migrations#list-organization-migrations
|
748
761
|
def migrations(org, options = {})
|
749
|
-
options = ensure_api_media_type(:migrations, options)
|
750
762
|
paginate "#{Organization.path(org)}/migrations", options
|
751
763
|
end
|
752
764
|
|
@@ -758,7 +770,6 @@ module Octokit
|
|
758
770
|
# @param id [Integer] ID number of the migration.
|
759
771
|
# @see https://docs.github.com/en/rest/reference/migrations#get-an-organization-migration-status
|
760
772
|
def migration_status(org, id, options = {})
|
761
|
-
options = ensure_api_media_type(:migrations, options)
|
762
773
|
get "#{Organization.path(org)}/migrations/#{id}", options
|
763
774
|
end
|
764
775
|
|
@@ -770,7 +781,6 @@ module Octokit
|
|
770
781
|
# @param id [Integer] ID number of the migration.
|
771
782
|
# @see https://docs.github.com/en/rest/reference/migrations#download-an-organization-migration-archive
|
772
783
|
def migration_archive_url(org, id, options = {})
|
773
|
-
options = ensure_api_media_type(:migrations, options)
|
774
784
|
url = "#{Organization.path(org)}/migrations/#{id}/archive"
|
775
785
|
|
776
786
|
response = client_without_redirects(options).get(url)
|
@@ -785,7 +795,6 @@ module Octokit
|
|
785
795
|
# @param id [Integer] ID number of the migration.
|
786
796
|
# @see https://docs.github.com/en/rest/reference/migrations#delete-an-organization-migration-archive
|
787
797
|
def delete_migration_archive(org, id, options = {})
|
788
|
-
options = ensure_api_media_type(:migrations, options)
|
789
798
|
delete "#{Organization.path(org)}/migrations/#{id}/archive", options
|
790
799
|
end
|
791
800
|
|
@@ -798,7 +807,6 @@ module Octokit
|
|
798
807
|
# @param repo [String] Name of the repository.
|
799
808
|
# @see https://docs.github.com/en/rest/reference/migrations#unlock-an-organization-repository
|
800
809
|
def unlock_repository(org, id, repo, options = {})
|
801
|
-
options = ensure_api_media_type(:migrations, options)
|
802
810
|
delete "#{Organization.path(org)}/migrations/#{id}/repos/#{repo}/lock", options
|
803
811
|
end
|
804
812
|
|
@@ -815,6 +823,26 @@ module Octokit
|
|
815
823
|
def billing_actions(org)
|
816
824
|
get "#{Organization.path(org)}/settings/billing/actions"
|
817
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
|
818
846
|
end
|
819
847
|
end
|
820
848
|
end
|
data/lib/octokit/client/pages.rb
CHANGED
@@ -24,8 +24,7 @@ module Octokit
|
|
24
24
|
# @example
|
25
25
|
# Octokit.pages_build("github/developer.github.com", 5472601)
|
26
26
|
def pages_build(repo, id, options = {})
|
27
|
-
|
28
|
-
get "#{Repository.path repo}/pages/builds/#{id}", opts
|
27
|
+
get "#{Repository.path repo}/pages/builds/#{id}", options
|
29
28
|
end
|
30
29
|
|
31
30
|
# List Pages builds for a repository
|
@@ -55,8 +54,7 @@ module Octokit
|
|
55
54
|
# @return [Sawyer::Resource] Request result
|
56
55
|
# @see https://developer.github.com/v3/repos/pages/#request-a-page-build
|
57
56
|
def request_page_build(repo, options = {})
|
58
|
-
|
59
|
-
post "#{Repository.path repo}/pages/builds", opts
|
57
|
+
post "#{Repository.path repo}/pages/builds", options
|
60
58
|
end
|
61
59
|
end
|
62
60
|
end
|