octokit 4.21.0 → 10.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 +120 -96
- data/Rakefile +20 -14
- data/lib/ext/sawyer/relation.rb +4 -2
- data/lib/octokit/arguments.rb +3 -3
- data/lib/octokit/authentication.rb +10 -3
- data/lib/octokit/client/actions_artifacts.rb +71 -0
- data/lib/octokit/client/actions_secrets.rb +111 -8
- data/lib/octokit/client/actions_workflow_jobs.rb +65 -0
- data/lib/octokit/client/actions_workflow_runs.rb +23 -3
- data/lib/octokit/client/actions_workflows.rb +27 -2
- data/lib/octokit/client/apps.rb +63 -74
- data/lib/octokit/client/checks.rb +18 -9
- data/lib/octokit/client/code_scanning.rb +190 -0
- data/lib/octokit/client/codespaces_secrets.rb +108 -0
- data/lib/octokit/client/commit_branches.rb +2 -2
- data/lib/octokit/client/commit_comments.rb +8 -8
- data/lib/octokit/client/commit_pulls.rb +2 -2
- data/lib/octokit/client/commits.rb +31 -34
- data/lib/octokit/client/community_profile.rb +2 -3
- data/lib/octokit/client/contents.rb +19 -22
- data/lib/octokit/client/dependabot_secrets.rb +108 -0
- data/lib/octokit/client/deployments.rb +8 -8
- data/lib/octokit/client/downloads.rb +5 -6
- data/lib/octokit/client/emojis.rb +3 -3
- data/lib/octokit/client/environments.rb +58 -0
- data/lib/octokit/client/events.rb +4 -5
- data/lib/octokit/client/feeds.rb +4 -5
- data/lib/octokit/client/gists.rb +6 -6
- data/lib/octokit/client/gitignore.rb +3 -3
- data/lib/octokit/client/hooks.rb +9 -19
- data/lib/octokit/client/issues.rb +14 -15
- data/lib/octokit/client/labels.rb +10 -10
- data/lib/octokit/client/legacy_search.rb +3 -3
- data/lib/octokit/client/licenses.rb +3 -6
- data/lib/octokit/client/markdown.rb +3 -3
- data/lib/octokit/client/marketplace.rb +4 -4
- data/lib/octokit/client/meta.rb +4 -5
- data/lib/octokit/client/milestones.rb +5 -5
- data/lib/octokit/client/notifications.rb +6 -6
- data/lib/octokit/client/oauth_applications.rb +1 -7
- data/lib/octokit/client/objects.rb +14 -14
- data/lib/octokit/client/organizations.rb +106 -62
- data/lib/octokit/client/pages.rb +5 -7
- data/lib/octokit/client/projects.rb +44 -64
- data/lib/octokit/client/pull_requests.rb +66 -45
- data/lib/octokit/client/rate_limit.rb +9 -11
- data/lib/octokit/client/reactions.rb +78 -16
- data/lib/octokit/client/refs.rb +15 -18
- data/lib/octokit/client/releases.rb +13 -13
- data/lib/octokit/client/repositories.rb +92 -69
- data/lib/octokit/client/repository_invitations.rb +3 -3
- data/lib/octokit/client/reviews.rb +8 -8
- data/lib/octokit/client/say.rb +4 -5
- data/lib/octokit/client/search.rb +24 -10
- data/lib/octokit/client/service_status.rb +19 -9
- data/lib/octokit/client/source_import.rb +7 -12
- data/lib/octokit/client/stats.rb +10 -9
- data/lib/octokit/client/statuses.rb +5 -5
- data/lib/octokit/client/tokens.rb +31 -0
- data/lib/octokit/client/traffic.rb +6 -11
- data/lib/octokit/client/users.rb +54 -33
- data/lib/octokit/client.rb +44 -20
- data/lib/octokit/configurable.rb +51 -31
- data/lib/octokit/connection.rb +33 -24
- data/lib/octokit/default.rb +66 -35
- data/lib/octokit/enterprise_admin_client/admin_stats.rb +13 -14
- data/lib/octokit/enterprise_admin_client/license.rb +3 -4
- data/lib/octokit/enterprise_admin_client/orgs.rb +3 -4
- data/lib/octokit/enterprise_admin_client/search_indexing.rb +7 -8
- data/lib/octokit/enterprise_admin_client/users.rb +5 -4
- data/lib/octokit/enterprise_admin_client.rb +9 -3
- data/lib/octokit/enterprise_management_console_client/management_console.rb +51 -33
- data/lib/octokit/enterprise_management_console_client.rb +8 -2
- data/lib/octokit/error.rb +53 -34
- data/lib/octokit/gist.rb +3 -4
- data/lib/octokit/manage_ghes_client/manage_ghes.rb +178 -0
- data/lib/octokit/manage_ghes_client.rb +64 -0
- data/lib/octokit/middleware/follow_redirects.rb +16 -12
- data/lib/octokit/organization.rb +3 -1
- data/lib/octokit/rate_limit.rb +8 -6
- data/lib/octokit/repo_arguments.rb +3 -4
- data/lib/octokit/repository.rb +32 -25
- data/lib/octokit/response/base_middleware.rb +10 -0
- data/lib/octokit/response/feed_parser.rb +5 -7
- data/lib/octokit/response/raise_error.rb +4 -4
- data/lib/octokit/user.rb +4 -2
- data/lib/octokit/version.rb +4 -2
- data/lib/octokit/warnable.rb +4 -5
- data/lib/octokit.rb +30 -8
- data/octokit.gemspec +12 -11
- metadata +22 -34
- data/lib/octokit/client/authorizations.rb +0 -182
- data/lib/octokit/client/pub_sub_hubbub.rb +0 -111
- data/lib/octokit/preview.rb +0 -46
@@ -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
|
@@ -1,28 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Actions Secrets API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/actions/secrets/
|
7
8
|
module ActionsSecrets
|
8
|
-
|
9
9
|
# Get public key for secrets encryption
|
10
10
|
#
|
11
11
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
12
12
|
# @return [Hash] key_id and key
|
13
13
|
# @see https://developer.github.com/v3/actions/secrets/#get-your-public-key
|
14
|
-
def
|
14
|
+
def get_actions_public_key(repo)
|
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
|
18
26
|
|
19
27
|
# List secrets
|
20
28
|
#
|
21
29
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
22
30
|
# @return [Hash] total_count and list of secrets (each item is hash with name, created_at and updated_at)
|
23
31
|
# @see https://developer.github.com/v3/actions/secrets/#list-secrets-for-a-repository
|
24
|
-
def
|
25
|
-
paginate "#{Repository.path repo}/actions/secrets"
|
32
|
+
def list_actions_secrets(repo)
|
33
|
+
paginate "#{Repository.path repo}/actions/secrets" do |data, last_response|
|
34
|
+
data.secrets.concat last_response.data.secrets
|
35
|
+
end
|
36
|
+
end
|
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
|
26
47
|
end
|
27
48
|
|
28
49
|
# Get a secret
|
@@ -31,28 +52,110 @@ module Octokit
|
|
31
52
|
# @param name [String] Name of secret
|
32
53
|
# @return [Hash] name, created_at and updated_at
|
33
54
|
# @see https://developer.github.com/v3/actions/secrets/#get-a-secret
|
34
|
-
def
|
55
|
+
def get_actions_secret(repo, name)
|
35
56
|
get "#{Repository.path repo}/actions/secrets/#{name}"
|
36
57
|
end
|
37
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
|
+
|
38
69
|
# Create or update secrets
|
39
70
|
#
|
40
71
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
41
72
|
# @param name [String] Name of secret
|
42
73
|
# @param options [Hash] encrypted_value and key_id
|
43
74
|
# @see https://developer.github.com/v3/actions/secrets/#create-or-update-a-secret-for-a-repository
|
44
|
-
def
|
75
|
+
def create_or_update_actions_secret(repo, name, options)
|
45
76
|
put "#{Repository.path repo}/actions/secrets/#{name}", options
|
46
77
|
end
|
47
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
|
+
|
48
89
|
# Delete a secret
|
49
90
|
#
|
50
91
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
51
92
|
# @param name [String] Name of secret
|
52
93
|
# @see https://developer.github.com/v3/actions/secrets/#delete-a-secret-from-a-repository
|
53
|
-
def
|
94
|
+
def delete_actions_secret(repo, name)
|
54
95
|
boolean_from_response :delete, "#{Repository.path repo}/actions/secrets/#{name}"
|
55
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://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
|
+
|
107
|
+
# Get environment public key for secrets encryption
|
108
|
+
#
|
109
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
110
|
+
# @param environment [String] Name of environment
|
111
|
+
# @return [Hash] key_id and key
|
112
|
+
# @see https://docs.github.com/en/rest/actions/secrets#get-an-environment-public-key
|
113
|
+
def get_actions_environment_public_key(repo, environment)
|
114
|
+
get "#{Repository.path repo}/environments/#{environment}/secrets/public-key"
|
115
|
+
end
|
116
|
+
|
117
|
+
# List environment secrets
|
118
|
+
#
|
119
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
120
|
+
# @param environment [String] Name of environment
|
121
|
+
# @return [Hash] total_count and list of secrets (each item is hash with name, created_at and updated_at)
|
122
|
+
# @see https://developer.github.com/v3/actions/secrets/#list-environment-secrets
|
123
|
+
def list_actions_environment_secrets(repo, environment)
|
124
|
+
paginate "#{Repository.path repo}/environments/#{environment}/secrets" do |data, last_response|
|
125
|
+
data.secrets.concat last_response.data.secrets
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
# Get an environment secret
|
130
|
+
#
|
131
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
132
|
+
# @param environment [String] Name of environment
|
133
|
+
# @param name [String] Name of secret
|
134
|
+
# @return [Hash] name, created_at and updated_at
|
135
|
+
# @see https://docs.github.com/en/rest/actions/secrets#get-an-environment-secret
|
136
|
+
def get_actions_environment_secret(repo, environment, name)
|
137
|
+
get "#{Repository.path repo}/environments/#{environment}/secrets/#{name}"
|
138
|
+
end
|
139
|
+
|
140
|
+
# Create or update an environment secret
|
141
|
+
#
|
142
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
143
|
+
# @param environment [String] Name of environment
|
144
|
+
# @param name [String] Name of secret
|
145
|
+
# @param options [Hash] encrypted_value and key_id
|
146
|
+
# @see https://docs.github.com/en/rest/actions/secrets#create-or-update-an-environment-secret
|
147
|
+
def create_or_update_actions_environment_secret(repo, environment, name, options)
|
148
|
+
put "#{Repository.path repo}/environments/#{environment}/secrets/#{name}", options
|
149
|
+
end
|
150
|
+
|
151
|
+
# Delete environment secret
|
152
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
153
|
+
# @param environment [String] Name of environment
|
154
|
+
# @param name [String] Name of secret
|
155
|
+
# @see https://docs.github.com/en/rest/actions/secrets#delete-an-environment-secret
|
156
|
+
def delete_actions_environment_secret(repo, environment, name)
|
157
|
+
boolean_from_response :delete, "#{Repository.path repo}/environments/#{environment}/secrets/#{name}"
|
158
|
+
end
|
56
159
|
end
|
57
160
|
end
|
58
161
|
end
|
@@ -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
|
@@ -1,5 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
5
|
+
# Methods for the Actions Workflows runs API
|
6
|
+
#
|
7
|
+
# @see https://docs.github.com/rest/actions/workflow-runs
|
3
8
|
module ActionsWorkflowRuns
|
4
9
|
# List all runs for a repository workflow
|
5
10
|
#
|
@@ -13,7 +18,9 @@ module Octokit
|
|
13
18
|
# @return [Sawyer::Resource] the total count and an array of workflows
|
14
19
|
# @see https://developer.github.com/v3/actions/workflow-runs/#list-workflow-runs
|
15
20
|
def workflow_runs(repo, workflow, options = {})
|
16
|
-
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
|
17
24
|
end
|
18
25
|
alias list_workflow_runs workflow_runs
|
19
26
|
|
@@ -28,7 +35,9 @@ module Octokit
|
|
28
35
|
# @return [Sawyer::Resource] the total count and an array of workflows
|
29
36
|
# @see https://developer.github.com/v3/actions/workflow-runs/#list-repository-workflow-runs
|
30
37
|
def repository_workflow_runs(repo, options = {})
|
31
|
-
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
|
32
41
|
end
|
33
42
|
alias list_repository_workflow_runs repository_workflow_runs
|
34
43
|
|
@@ -90,7 +99,7 @@ module Octokit
|
|
90
99
|
response.headers['Location']
|
91
100
|
end
|
92
101
|
|
93
|
-
#
|
102
|
+
# Delete all log files of a workflow run
|
94
103
|
#
|
95
104
|
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
96
105
|
# @param id [Integer] Id of a workflow run
|
@@ -100,6 +109,17 @@ module Octokit
|
|
100
109
|
def delete_workflow_run_logs(repo, id, options = {})
|
101
110
|
boolean_from_response :delete, "#{Repository.path repo}/actions/runs/#{id}/logs", options
|
102
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
|
103
123
|
end
|
104
124
|
end
|
105
125
|
end
|
@@ -1,10 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
5
|
# Methods for the Actions Workflows API
|
4
6
|
#
|
5
7
|
# @see https://developer.github.com/v3/actions/workflows
|
6
8
|
module ActionsWorkflows
|
7
|
-
|
8
9
|
# Get the workflows in a repository
|
9
10
|
#
|
10
11
|
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
@@ -12,7 +13,9 @@ module Octokit
|
|
12
13
|
# @return [Sawyer::Resource] the total count and an array of workflows
|
13
14
|
# @see https://developer.github.com/v3/actions/workflows/#list-repository-workflows
|
14
15
|
def workflows(repo, options = {})
|
15
|
-
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
|
16
19
|
end
|
17
20
|
alias list_workflows workflows
|
18
21
|
|
@@ -38,6 +41,28 @@ module Octokit
|
|
38
41
|
def workflow_dispatch(repo, id, ref, options = {})
|
39
42
|
boolean_from_response :post, "#{Repository.path repo}/actions/workflows/#{id}/dispatches", options.merge({ ref: ref })
|
40
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
|
41
66
|
end
|
42
67
|
end
|
43
68
|
end
|