octokit 4.22.0 → 9.2.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 +117 -95
- 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 -26
- 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 +25 -33
- 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 +100 -56
- 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 +62 -16
- data/lib/octokit/client/refs.rb +14 -17
- 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 +42 -18
- data/lib/octokit/configurable.rb +51 -31
- data/lib/octokit/connection.rb +30 -21
- 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 +51 -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 +13 -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 +19 -31
- 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
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Organizations API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/orgs/
|
7
8
|
module Organizations
|
8
|
-
|
9
9
|
# Get an organization
|
10
10
|
#
|
11
11
|
# @param org [String, Integer] Organization GitHub login or id.
|
@@ -18,7 +18,7 @@ module Octokit
|
|
18
18
|
def organization(org, options = {})
|
19
19
|
get Organization.path(org), options
|
20
20
|
end
|
21
|
-
alias
|
21
|
+
alias org organization
|
22
22
|
|
23
23
|
# Update an organization.
|
24
24
|
#
|
@@ -48,14 +48,30 @@ module Octokit
|
|
48
48
|
def update_organization(org, values, options = {})
|
49
49
|
patch Organization.path(org), options.merge(values)
|
50
50
|
end
|
51
|
-
alias
|
51
|
+
alias update_org update_organization
|
52
|
+
|
53
|
+
# Delete an organization.
|
54
|
+
#
|
55
|
+
# Requires authenticated organization owner.
|
56
|
+
#
|
57
|
+
# @param org [String, Integer] Organization login or ID.
|
58
|
+
# @return [Boolean] True if deletion successful, otherwise false.
|
59
|
+
# @see https://docs.github.com/rest/orgs/orgs#delete-an-organization
|
60
|
+
# @example
|
61
|
+
# @client.delete_organization("my-org")
|
62
|
+
# @example
|
63
|
+
# @client.delete_org("my-org")
|
64
|
+
def delete_organization(org)
|
65
|
+
boolean_from_response :delete, Organization.path(org)
|
66
|
+
end
|
67
|
+
alias delete_org delete_organization
|
52
68
|
|
53
69
|
# Get organizations for a user.
|
54
70
|
#
|
55
71
|
# Nonauthenticated calls to this method will return organizations that
|
56
72
|
# the user is a public member.
|
57
73
|
#
|
58
|
-
# Use an
|
74
|
+
# Use an authenticated client to get both public and private organizations
|
59
75
|
# for a user.
|
60
76
|
#
|
61
77
|
# Calling this method on a `@client` will return that users organizations.
|
@@ -78,12 +94,12 @@ module Octokit
|
|
78
94
|
# Octokit.list_orgs('pengwynn')
|
79
95
|
# @example
|
80
96
|
# @client.organizations
|
81
|
-
def organizations(user=nil, options = {})
|
97
|
+
def organizations(user = nil, options = {})
|
82
98
|
paginate "#{User.path user}/orgs", options
|
83
99
|
end
|
84
|
-
alias
|
85
|
-
alias
|
86
|
-
alias
|
100
|
+
alias list_organizations organizations
|
101
|
+
alias list_orgs organizations
|
102
|
+
alias orgs organizations
|
87
103
|
|
88
104
|
# List all GitHub organizations
|
89
105
|
#
|
@@ -98,9 +114,9 @@ module Octokit
|
|
98
114
|
#
|
99
115
|
# @return [Array<Sawyer::Resource>] List of GitHub organizations.
|
100
116
|
def all_organizations(options = {})
|
101
|
-
paginate
|
117
|
+
paginate 'organizations', options
|
102
118
|
end
|
103
|
-
alias
|
119
|
+
alias all_orgs all_organizations
|
104
120
|
|
105
121
|
# List organization repositories
|
106
122
|
#
|
@@ -125,8 +141,8 @@ module Octokit
|
|
125
141
|
def organization_repositories(org, options = {})
|
126
142
|
paginate "#{Organization.path org}/repos", options
|
127
143
|
end
|
128
|
-
alias
|
129
|
-
alias
|
144
|
+
alias org_repositories organization_repositories
|
145
|
+
alias org_repos organization_repositories
|
130
146
|
|
131
147
|
# Get organization members
|
132
148
|
#
|
@@ -143,10 +159,10 @@ module Octokit
|
|
143
159
|
# Octokit.org_members('github')
|
144
160
|
def organization_members(org, options = {})
|
145
161
|
options = options.dup
|
146
|
-
path =
|
162
|
+
path = 'public_' if options.delete(:public)
|
147
163
|
paginate "#{Organization.path org}/#{path}members", options
|
148
164
|
end
|
149
|
-
alias
|
165
|
+
alias org_members organization_members
|
150
166
|
|
151
167
|
# Get organization public members
|
152
168
|
#
|
@@ -160,9 +176,9 @@ module Octokit
|
|
160
176
|
# @example
|
161
177
|
# Octokit.org_public_members('github')
|
162
178
|
def organization_public_members(org, options = {})
|
163
|
-
organization_members org, options.merge(:
|
179
|
+
organization_members org, options.merge(public: true)
|
164
180
|
end
|
165
|
-
alias
|
181
|
+
alias org_public_members organization_public_members
|
166
182
|
|
167
183
|
# Check if a user is a member of an organization.
|
168
184
|
#
|
@@ -188,7 +204,7 @@ module Octokit
|
|
188
204
|
result
|
189
205
|
end
|
190
206
|
end
|
191
|
-
alias
|
207
|
+
alias org_member? organization_member?
|
192
208
|
|
193
209
|
# Check if a user is a public member of an organization.
|
194
210
|
#
|
@@ -208,7 +224,7 @@ module Octokit
|
|
208
224
|
def organization_public_member?(org, user, options = {})
|
209
225
|
boolean_from_response :get, "#{Organization.path org}/public_members/#{user}", options
|
210
226
|
end
|
211
|
-
alias
|
227
|
+
alias org_public_member? organization_public_member?
|
212
228
|
|
213
229
|
# List pending organization invitations
|
214
230
|
#
|
@@ -223,7 +239,7 @@ module Octokit
|
|
223
239
|
def organization_invitations(org, options = {})
|
224
240
|
get "#{Organization.path org}/invitations", options
|
225
241
|
end
|
226
|
-
alias
|
242
|
+
alias org_invitations organization_invitations
|
227
243
|
|
228
244
|
# List outside collaborators for an organization
|
229
245
|
#
|
@@ -235,7 +251,7 @@ module Octokit
|
|
235
251
|
#
|
236
252
|
# @example
|
237
253
|
# @client.outside_collaborators('github')
|
238
|
-
def outside_collaborators(org, options={})
|
254
|
+
def outside_collaborators(org, options = {})
|
239
255
|
paginate "#{Organization.path org}/outside_collaborators", options
|
240
256
|
end
|
241
257
|
|
@@ -250,7 +266,7 @@ module Octokit
|
|
250
266
|
#
|
251
267
|
# @example
|
252
268
|
# @client.remove_outside_collaborator('github', 'lizzhale')
|
253
|
-
def remove_outside_collaborator(org, user, options={})
|
269
|
+
def remove_outside_collaborator(org, user, options = {})
|
254
270
|
boolean_from_response :delete, "#{Organization.path org}/outside_collaborators/#{user}", options
|
255
271
|
end
|
256
272
|
|
@@ -265,7 +281,7 @@ module Octokit
|
|
265
281
|
#
|
266
282
|
# @example
|
267
283
|
# @client.convert_to_outside_collaborator('github', 'lizzhale')
|
268
|
-
def convert_to_outside_collaborator(org, user, options={})
|
284
|
+
def convert_to_outside_collaborator(org, user, options = {})
|
269
285
|
boolean_from_response :put, "#{Organization.path org}/outside_collaborators/#{user}", options
|
270
286
|
end
|
271
287
|
|
@@ -283,7 +299,7 @@ module Octokit
|
|
283
299
|
def organization_teams(org, options = {})
|
284
300
|
paginate "#{Organization.path org}/teams", options
|
285
301
|
end
|
286
|
-
alias
|
302
|
+
alias org_teams organization_teams
|
287
303
|
|
288
304
|
# Create team
|
289
305
|
#
|
@@ -303,10 +319,7 @@ module Octokit
|
|
303
319
|
# })
|
304
320
|
def create_team(org, options = {})
|
305
321
|
if options.key?(:permission)
|
306
|
-
octokit_warn
|
307
|
-
end
|
308
|
-
if options.key?(:parent_team_id)
|
309
|
-
options = ensure_api_media_type(:nested_teams, options)
|
322
|
+
octokit_warn 'Deprecated: Passing :permission option to #create_team. Assign team repository permission by passing :permission to #add_team_repository instead.'
|
310
323
|
end
|
311
324
|
post "#{Organization.path org}/teams", options
|
312
325
|
end
|
@@ -338,6 +351,27 @@ module Octokit
|
|
338
351
|
get "#{Organization.path(org)}/teams/#{team_slug}", options
|
339
352
|
end
|
340
353
|
|
354
|
+
# Check team permissions for a repository
|
355
|
+
#
|
356
|
+
# Requires authenticated organization member.
|
357
|
+
#
|
358
|
+
# @param org [String, Integer] Organization GitHub login or id.
|
359
|
+
# @param team_slug_or_id [String, Integer] Team slug or Team ID.
|
360
|
+
# @param owner [String] Owner name for the repository.
|
361
|
+
# @param repo [String] Name of the repo to check permissions against.
|
362
|
+
# @return [String, Sawyer::Resource] Depending on options it may be an empty string or a resource.
|
363
|
+
# @example
|
364
|
+
# # Check whether the team has any permissions with the repository
|
365
|
+
# @client.team_permissions_for_repo("github", "justice-league", "octocat", "hello-world")
|
366
|
+
#
|
367
|
+
# @example
|
368
|
+
# # Get the full repository object including the permissions level and role for the team
|
369
|
+
# @client.team_permissions_for_repo("github", "justice-league", "octocat", "hello-world", :accept => 'application/vnd.github.v3.repository+json')
|
370
|
+
# @see https://docs.github.com/en/rest/teams/teams#check-team-permissions-for-a-repository
|
371
|
+
def team_permissions_for_repo(org, team_slug_or_id, owner, repo, options = {})
|
372
|
+
get "#{Organization.path(org)}/teams/#{team_slug_or_id}/repos/#{owner}/#{repo}", options
|
373
|
+
end
|
374
|
+
|
341
375
|
# List child teams
|
342
376
|
#
|
343
377
|
# Requires authenticated organization member.
|
@@ -348,7 +382,6 @@ module Octokit
|
|
348
382
|
# @example
|
349
383
|
# @client.child_teams(100000, :accept => "application/vnd.github.hellcat-preview+json")
|
350
384
|
def child_teams(team_id, options = {})
|
351
|
-
options = ensure_api_media_type(:nested_teams, options)
|
352
385
|
paginate "teams/#{team_id}/teams", options
|
353
386
|
end
|
354
387
|
|
@@ -372,9 +405,6 @@ module Octokit
|
|
372
405
|
# :permission => 'push'
|
373
406
|
# })
|
374
407
|
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
408
|
patch "teams/#{team_id}", options
|
379
409
|
end
|
380
410
|
|
@@ -429,7 +459,7 @@ module Octokit
|
|
429
459
|
# There's a bug in this API call. The docs say to leave the body blank,
|
430
460
|
# but it fails if the body is both blank and the content-length header
|
431
461
|
# is not 0.
|
432
|
-
boolean_from_response :put, "teams/#{team_id}/members/#{user}", options.merge({:
|
462
|
+
boolean_from_response :put, "teams/#{team_id}/members/#{user}", options.merge({ name: user })
|
433
463
|
end
|
434
464
|
|
435
465
|
# Remove team member
|
@@ -494,7 +524,7 @@ module Octokit
|
|
494
524
|
def team_repositories(team_id, options = {})
|
495
525
|
paginate "teams/#{team_id}/repos", options
|
496
526
|
end
|
497
|
-
alias
|
527
|
+
alias team_repos team_repositories
|
498
528
|
|
499
529
|
# Check if a repo is managed by a specific team
|
500
530
|
#
|
@@ -508,10 +538,10 @@ module Octokit
|
|
508
538
|
# @client.team_repository?(8675309, 'octokit/octokit.rb')
|
509
539
|
# @example
|
510
540
|
# @client.team_repo?(8675309, 'octokit/octokit.rb')
|
511
|
-
def team_repository?(team_id, repo,
|
541
|
+
def team_repository?(team_id, repo, _options = {})
|
512
542
|
boolean_from_response :get, "teams/#{team_id}/repos/#{Repository.new(repo)}"
|
513
543
|
end
|
514
|
-
alias
|
544
|
+
alias team_repo? team_repository?
|
515
545
|
|
516
546
|
# Add team repository
|
517
547
|
#
|
@@ -540,7 +570,7 @@ module Octokit
|
|
540
570
|
def add_team_repository(team_id, repo, options = {})
|
541
571
|
boolean_from_response :put, "teams/#{team_id}/repos/#{Repository.new(repo)}", options
|
542
572
|
end
|
543
|
-
alias
|
573
|
+
alias add_team_repo add_team_repository
|
544
574
|
|
545
575
|
# Remove team repository
|
546
576
|
#
|
@@ -557,10 +587,10 @@ module Octokit
|
|
557
587
|
# @client.remove_team_repository(100000, 'github/developer.github.com')
|
558
588
|
# @example
|
559
589
|
# @client.remove_team_repo(100000, 'github/developer.github.com')
|
560
|
-
def remove_team_repository(team_id, repo,
|
590
|
+
def remove_team_repository(team_id, repo, _options = {})
|
561
591
|
boolean_from_response :delete, "teams/#{team_id}/repos/#{Repository.new(repo)}"
|
562
592
|
end
|
563
|
-
alias
|
593
|
+
alias remove_team_repo remove_team_repository
|
564
594
|
|
565
595
|
# Remove organization member
|
566
596
|
#
|
@@ -579,7 +609,7 @@ module Octokit
|
|
579
609
|
# provided in the GH API v3
|
580
610
|
boolean_from_response :delete, "#{Organization.path org}/members/#{user}", options
|
581
611
|
end
|
582
|
-
alias
|
612
|
+
alias remove_org_member remove_organization_member
|
583
613
|
|
584
614
|
# Publicize a user's membership of an organization
|
585
615
|
#
|
@@ -610,14 +640,14 @@ module Octokit
|
|
610
640
|
def unpublicize_membership(org, user, options = {})
|
611
641
|
boolean_from_response :delete, "#{Organization.path org}/public_members/#{user}", options
|
612
642
|
end
|
613
|
-
alias
|
643
|
+
alias conceal_membership unpublicize_membership
|
614
644
|
|
615
645
|
# List all teams for the authenticated user across all their orgs
|
616
646
|
#
|
617
647
|
# @return [Array<Sawyer::Resource>] Array of team resources.
|
618
648
|
# @see https://developer.github.com/v3/orgs/teams/#list-user-teams
|
619
649
|
def user_teams(options = {})
|
620
|
-
paginate
|
650
|
+
paginate 'user/teams', options
|
621
651
|
end
|
622
652
|
|
623
653
|
# Check if a user has a team membership.
|
@@ -667,9 +697,9 @@ module Octokit
|
|
667
697
|
# @return [Array<Sawyer::Resource>] Array of organizations memberships.
|
668
698
|
# @see https://developer.github.com/v3/orgs/members/#list-your-organization-memberships
|
669
699
|
def organization_memberships(options = {})
|
670
|
-
paginate
|
700
|
+
paginate 'user/memberships/orgs', options
|
671
701
|
end
|
672
|
-
alias
|
702
|
+
alias org_memberships organization_memberships
|
673
703
|
|
674
704
|
# Get an organization membership
|
675
705
|
#
|
@@ -686,7 +716,7 @@ module Octokit
|
|
686
716
|
get "user/memberships/orgs/#{org}", options
|
687
717
|
end
|
688
718
|
end
|
689
|
-
alias
|
719
|
+
alias org_membership organization_membership
|
690
720
|
|
691
721
|
# Edit an organization membership
|
692
722
|
#
|
@@ -707,7 +737,7 @@ module Octokit
|
|
707
737
|
patch "user/memberships/orgs/#{org}", options
|
708
738
|
end
|
709
739
|
end
|
710
|
-
alias
|
740
|
+
alias update_org_membership update_organization_membership
|
711
741
|
|
712
742
|
# Remove an organization membership
|
713
743
|
#
|
@@ -719,7 +749,7 @@ module Octokit
|
|
719
749
|
user = options.delete(:user)
|
720
750
|
user && boolean_from_response(:delete, "#{Organization.path(org)}/memberships/#{user}", options)
|
721
751
|
end
|
722
|
-
alias
|
752
|
+
alias remove_org_membership remove_organization_membership
|
723
753
|
|
724
754
|
# Initiates the generation of a migration archive.
|
725
755
|
#
|
@@ -733,7 +763,6 @@ module Octokit
|
|
733
763
|
# @client.start_migration('github', ['github/dotfiles'])
|
734
764
|
# @see https://docs.github.com/en/rest/reference/migrations#start-an-organization-migration
|
735
765
|
def start_migration(org, repositories, options = {})
|
736
|
-
options = ensure_api_media_type(:migrations, options)
|
737
766
|
options[:repositories] = repositories
|
738
767
|
post "#{Organization.path(org)}/migrations", options
|
739
768
|
end
|
@@ -746,7 +775,6 @@ module Octokit
|
|
746
775
|
# @return [Array<Sawyer::Resource>] Array of migration resources.
|
747
776
|
# @see https://docs.github.com/en/rest/reference/migrations#list-organization-migrations
|
748
777
|
def migrations(org, options = {})
|
749
|
-
options = ensure_api_media_type(:migrations, options)
|
750
778
|
paginate "#{Organization.path(org)}/migrations", options
|
751
779
|
end
|
752
780
|
|
@@ -758,7 +786,6 @@ module Octokit
|
|
758
786
|
# @param id [Integer] ID number of the migration.
|
759
787
|
# @see https://docs.github.com/en/rest/reference/migrations#get-an-organization-migration-status
|
760
788
|
def migration_status(org, id, options = {})
|
761
|
-
options = ensure_api_media_type(:migrations, options)
|
762
789
|
get "#{Organization.path(org)}/migrations/#{id}", options
|
763
790
|
end
|
764
791
|
|
@@ -770,7 +797,6 @@ module Octokit
|
|
770
797
|
# @param id [Integer] ID number of the migration.
|
771
798
|
# @see https://docs.github.com/en/rest/reference/migrations#download-an-organization-migration-archive
|
772
799
|
def migration_archive_url(org, id, options = {})
|
773
|
-
options = ensure_api_media_type(:migrations, options)
|
774
800
|
url = "#{Organization.path(org)}/migrations/#{id}/archive"
|
775
801
|
|
776
802
|
response = client_without_redirects(options).get(url)
|
@@ -785,7 +811,6 @@ module Octokit
|
|
785
811
|
# @param id [Integer] ID number of the migration.
|
786
812
|
# @see https://docs.github.com/en/rest/reference/migrations#delete-an-organization-migration-archive
|
787
813
|
def delete_migration_archive(org, id, options = {})
|
788
|
-
options = ensure_api_media_type(:migrations, options)
|
789
814
|
delete "#{Organization.path(org)}/migrations/#{id}/archive", options
|
790
815
|
end
|
791
816
|
|
@@ -798,23 +823,42 @@ module Octokit
|
|
798
823
|
# @param repo [String] Name of the repository.
|
799
824
|
# @see https://docs.github.com/en/rest/reference/migrations#unlock-an-organization-repository
|
800
825
|
def unlock_repository(org, id, repo, options = {})
|
801
|
-
options = ensure_api_media_type(:migrations, options)
|
802
826
|
delete "#{Organization.path(org)}/migrations/#{id}/repos/#{repo}/lock", options
|
803
827
|
end
|
804
828
|
|
805
829
|
# Get GitHub Actions billing for an organization
|
806
|
-
#
|
830
|
+
#
|
807
831
|
# Requires authenticated organization owner.
|
808
|
-
#
|
832
|
+
#
|
809
833
|
# @param org [String, Integer] Organization GitHub login or id.
|
810
834
|
# @return [Sawyer::Resource] Hash representing GitHub Actions billing for an organization.
|
811
835
|
# @see https://docs.github.com/en/rest/reference/billing#get-github-actions-billing-for-an-organization
|
812
|
-
#
|
836
|
+
#
|
813
837
|
# @example
|
814
838
|
# @client.billing_actions('github')
|
815
839
|
def billing_actions(org)
|
816
840
|
get "#{Organization.path(org)}/settings/billing/actions"
|
817
841
|
end
|
842
|
+
|
843
|
+
# Get organization audit log.
|
844
|
+
#
|
845
|
+
# Gets the audit log for an organization.
|
846
|
+
#
|
847
|
+
# @param org [String, Integer] Organization GitHub login or id for which
|
848
|
+
# to retrieve the audit log.
|
849
|
+
# @option options [String] :include ('all') Filter by event type.
|
850
|
+
# `all`, `git` or `web`.
|
851
|
+
# @option options [String] :phrase A search phrase.
|
852
|
+
# @option options [String] :order ('desc') The order of audit log events. To list newest events first, specify desc.
|
853
|
+
# To list oldest events first, specify asc.
|
854
|
+
#
|
855
|
+
# @return [Array<Sawyer::Resource>] List of events
|
856
|
+
# @see https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/orgs#get-the-audit-log-for-an-organization
|
857
|
+
# @example
|
858
|
+
# Octokit.organization_audit_log('github', {include: 'all', phrase: 'action:org.add_member created:>2022-08-29 user:octocat'})
|
859
|
+
def organization_audit_log(org, options = {})
|
860
|
+
paginate "#{Organization.path org}/audit-log", options
|
861
|
+
end
|
818
862
|
end
|
819
863
|
end
|
820
864
|
end
|
data/lib/octokit/client/pages.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Pages API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/repos/pages/
|
7
8
|
module Pages
|
8
|
-
|
9
9
|
# List Pages information for a repository
|
10
10
|
#
|
11
11
|
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
@@ -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
|
@@ -36,7 +35,7 @@ module Octokit
|
|
36
35
|
def pages_builds(repo, options = {})
|
37
36
|
get "#{Repository.path repo}/pages/builds", options
|
38
37
|
end
|
39
|
-
alias
|
38
|
+
alias list_pages_builds pages_builds
|
40
39
|
|
41
40
|
# List the latest Pages build information for a repository
|
42
41
|
#
|
@@ -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
|