saltext.github 1.1.0__py3-none-any.whl

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.
Files changed (73) hide show
  1. saltext/github/__init__.py +31 -0
  2. saltext/github/modules/__init__.py +0 -0
  3. saltext/github/modules/github.py +1873 -0
  4. saltext/github/modules/github_org.py +667 -0
  5. saltext/github/modules/github_repo.py +1658 -0
  6. saltext/github/modules/github_user.py +75 -0
  7. saltext/github/resources/__init__.py +0 -0
  8. saltext/github/resources/github/__init__.py +251 -0
  9. saltext/github/resources/github/modules/__init__.py +0 -0
  10. saltext/github/resources/github/modules/actions.py +175 -0
  11. saltext/github/resources/github/modules/config.py +69 -0
  12. saltext/github/resources/github/modules/deploy_key.py +122 -0
  13. saltext/github/resources/github/modules/environment.py +241 -0
  14. saltext/github/resources/github/modules/grains.py +18 -0
  15. saltext/github/resources/github/modules/issue.py +157 -0
  16. saltext/github/resources/github/modules/label.py +161 -0
  17. saltext/github/resources/github/modules/milestone.py +103 -0
  18. saltext/github/resources/github/modules/pages.py +149 -0
  19. saltext/github/resources/github/modules/pull.py +90 -0
  20. saltext/github/resources/github/modules/repo.py +155 -0
  21. saltext/github/resources/github/modules/ruleset.py +144 -0
  22. saltext/github/resources/github/modules/saltutil.py +24 -0
  23. saltext/github/resources/github/modules/state.py +116 -0
  24. saltext/github/resources/github/modules/test.py +29 -0
  25. saltext/github/resources/github/states/__init__.py +0 -0
  26. saltext/github/resources/github/states/actions.py +117 -0
  27. saltext/github/resources/github/states/deploy_key.py +130 -0
  28. saltext/github/resources/github/states/environment.py +99 -0
  29. saltext/github/resources/github/states/label.py +71 -0
  30. saltext/github/resources/github/states/pages.py +92 -0
  31. saltext/github/resources/github/states/repo.py +108 -0
  32. saltext/github/resources/github/states/ruleset.py +81 -0
  33. saltext/github/states/__init__.py +0 -0
  34. saltext/github/states/github.py +966 -0
  35. saltext/github/states/github_org.py +369 -0
  36. saltext/github/states/github_repo.py +722 -0
  37. saltext/github/utils/__init__.py +72 -0
  38. saltext/github/utils/gh/__init__.py +14 -0
  39. saltext/github/utils/gh/actions.py +195 -0
  40. saltext/github/utils/gh/cache.py +126 -0
  41. saltext/github/utils/gh/client.py +534 -0
  42. saltext/github/utils/gh/deploy_keys.py +121 -0
  43. saltext/github/utils/gh/environments.py +271 -0
  44. saltext/github/utils/gh/exceptions.py +28 -0
  45. saltext/github/utils/gh/grains_files.py +366 -0
  46. saltext/github/utils/gh/issues.py +193 -0
  47. saltext/github/utils/gh/labels.py +142 -0
  48. saltext/github/utils/gh/members.py +157 -0
  49. saltext/github/utils/gh/milestones.py +122 -0
  50. saltext/github/utils/gh/pages.py +128 -0
  51. saltext/github/utils/gh/profile.py +458 -0
  52. saltext/github/utils/gh/pulls.py +99 -0
  53. saltext/github/utils/gh/repos.py +465 -0
  54. saltext/github/utils/gh/resource.py +35 -0
  55. saltext/github/utils/gh/rulesets.py +191 -0
  56. saltext/github/utils/gh/statecores/__init__.py +70 -0
  57. saltext/github/utils/gh/statecores/actions.py +180 -0
  58. saltext/github/utils/gh/statecores/deploy_keys.py +241 -0
  59. saltext/github/utils/gh/statecores/environments.py +212 -0
  60. saltext/github/utils/gh/statecores/labels.py +116 -0
  61. saltext/github/utils/gh/statecores/pages.py +177 -0
  62. saltext/github/utils/gh/statecores/repo.py +249 -0
  63. saltext/github/utils/gh/statecores/rulesets.py +115 -0
  64. saltext/github/utils/gh/teams.py +375 -0
  65. saltext/github/utils/gh/users.py +87 -0
  66. saltext/github/version.py +1 -0
  67. saltext_github-1.1.0.dist-info/METADATA +151 -0
  68. saltext_github-1.1.0.dist-info/RECORD +73 -0
  69. saltext_github-1.1.0.dist-info/WHEEL +5 -0
  70. saltext_github-1.1.0.dist-info/entry_points.txt +2 -0
  71. saltext_github-1.1.0.dist-info/licenses/LICENSE +201 -0
  72. saltext_github-1.1.0.dist-info/licenses/NOTICE +10 -0
  73. saltext_github-1.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,667 @@
1
+ """
2
+ Manage a GitHub organization: members, teams and organization rulesets.
3
+
4
+ .. versionadded:: 1.1.0
5
+
6
+ Unlike the legacy functions in the :py:mod:`github <saltext.github.modules.github>` module,
7
+ the functions in this module raise errors (usually subclasses of
8
+ :py:class:`CommandExecutionError <salt.exceptions.CommandExecutionError>`)
9
+ instead of logging them and returning ``False``.
10
+
11
+ Collections with a unique natural key (teams, team repositories) are
12
+ returned as mappings keyed by it, id-addressed collections (rulesets)
13
+ as lists.
14
+
15
+ .. note::
16
+
17
+ This module is organization-scoped: all functions target an
18
+ organization, defaulting to the profile's :ghconf:`owner` (which hence
19
+ must be an organization) and accepting an ``owner`` argument to
20
+ manage another organization. Repository listing and creation live
21
+ in the :py:mod:`github_repo <saltext.github.modules.github_repo>`
22
+ module since they also apply to user accounts.
23
+
24
+ :depends: PyGithub python module
25
+
26
+ Configuration
27
+ -------------
28
+
29
+ This module reads its configuration from profiles, which are described
30
+ in the :ref:`configuration guide <github-configuration>`. The profile's
31
+ :ghconf:`owner` must be set to the managed organization.
32
+ """
33
+
34
+ import logging
35
+
36
+ from saltext.github.utils import filter_fields
37
+ from saltext.github.utils.gh import members as gh_members
38
+ from saltext.github.utils.gh import profile as gh_profile
39
+ from saltext.github.utils.gh import rulesets as gh_rulesets
40
+ from saltext.github.utils.gh import teams as gh_teams
41
+ from saltext.github.utils.gh import users as gh_users
42
+
43
+ log = logging.getLogger(__name__)
44
+
45
+ __virtualname__ = "github_org"
46
+
47
+
48
+ def _get_conn(profile):
49
+ return gh_profile.get_conn(profile, opts=__opts__, context=__context__)
50
+
51
+
52
+ def info(name=None, profile="github"):
53
+ """
54
+ Return the public profile of an organization account. Fails when the
55
+ account is a user. Use :py:func:`github.account_info
56
+ <saltext.github.modules.github.account_info>` to look up accounts of
57
+ either type.
58
+
59
+ CLI Example:
60
+
61
+ .. code-block:: bash
62
+
63
+ salt-call github_org.info github-org
64
+ salt-call github_org.info # the profile's owner
65
+
66
+ name
67
+ Login of the organization to look up. Defaults to the organization
68
+ specified in the profile's :ghconf:`owner`.
69
+
70
+ profile
71
+ Profile configuration name to use. Defaults to ``github``.
72
+ """
73
+ return gh_users.get_info(_get_conn(profile), name, expect="Organization")
74
+
75
+
76
+ def list_members(owner=None, ignore_cache=False, profile="github"):
77
+ """
78
+ List the logins of all members of the organization.
79
+
80
+ CLI Example:
81
+
82
+ .. code-block:: bash
83
+
84
+ salt-call github_org.list_members
85
+
86
+ owner
87
+ Organization to target. Defaults to the profile's ``owner``.
88
+
89
+ ignore_cache
90
+ Bypass the use of cached members.
91
+
92
+ profile
93
+ Profile configuration name to use. Defaults to ``github``.
94
+ """
95
+ return gh_members.list_all(_get_conn(profile), owner=owner, ignore_cache=ignore_cache)
96
+
97
+
98
+ def get_member(name, owner=None, profile="github"):
99
+ """
100
+ Return information about a user, including their organization
101
+ membership state (``in_org`` and ``membership_state``).
102
+
103
+ CLI Example:
104
+
105
+ .. code-block:: bash
106
+
107
+ salt-call github_org.get_member github-handle
108
+
109
+ name
110
+ Login of the user.
111
+
112
+ owner
113
+ Organization to target. Defaults to the profile's ``owner``.
114
+
115
+ profile
116
+ Profile configuration name to use. Defaults to ``github``.
117
+ """
118
+ return gh_members.get_info(_get_conn(profile), name, owner=owner)
119
+
120
+
121
+ def add_member(name, owner=None, profile="github"):
122
+ """
123
+ Invite a user into the organization. Returns whether the resulting
124
+ membership is ``pending`` (i.e. an invitation that needs to be
125
+ accepted first).
126
+
127
+ CLI Example:
128
+
129
+ .. code-block:: bash
130
+
131
+ salt-call github_org.add_member github-handle
132
+
133
+ name
134
+ Login of the user to invite.
135
+
136
+ owner
137
+ Organization to target. Defaults to the profile's ``owner``.
138
+
139
+ profile
140
+ Profile configuration name to use. Defaults to ``github``.
141
+ """
142
+ return gh_members.invite(_get_conn(profile), name, owner=owner)
143
+
144
+
145
+ def remove_member(name, owner=None, profile="github"):
146
+ """
147
+ Remove a user from the organization.
148
+
149
+ CLI Example:
150
+
151
+ .. code-block:: bash
152
+
153
+ salt-call github_org.remove_member github-handle
154
+
155
+ name
156
+ Login of the user to remove.
157
+
158
+ owner
159
+ Organization to target. Defaults to the profile's ``owner``.
160
+
161
+ profile
162
+ Profile configuration name to use. Defaults to ``github``.
163
+ """
164
+ gh_members.remove(_get_conn(profile), name, owner=owner)
165
+ return True
166
+
167
+
168
+ def _strip_team_caches(team_info):
169
+ """
170
+ Render a team cache entry for output, without the attached
171
+ repository/member caches.
172
+ """
173
+ return {key: val for key, val in team_info.items() if key not in ("repos", "members")}
174
+
175
+
176
+ def list_teams(owner=None, fields=None, ignore_cache=False, profile="github"):
177
+ """
178
+ List all teams of the organization, as a mapping of team name
179
+ to team details.
180
+
181
+ CLI Example:
182
+
183
+ .. code-block:: bash
184
+
185
+ salt-call github_org.list_teams
186
+
187
+ owner
188
+ Organization owning the team. Defaults to the profile's :ghconf:`owner`.
189
+
190
+ fields
191
+ Only include these fields in the output. A single field name
192
+ reduces each entry to the field's value.
193
+
194
+ ignore_cache
195
+ Bypass the use of cached teams.
196
+
197
+ profile
198
+ Profile configuration name to use. Defaults to ``github``.
199
+ """
200
+ teams = gh_teams.list_all(_get_conn(profile), owner=owner, ignore_cache=ignore_cache)
201
+ return filter_fields({name: _strip_team_caches(team) for name, team in teams.items()}, fields)
202
+
203
+
204
+ def get_team(name, owner=None, profile="github"):
205
+ """
206
+ Return the details of a single team.
207
+
208
+ CLI Example:
209
+
210
+ .. code-block:: bash
211
+
212
+ salt-call github_org.get_team 'team_name'
213
+
214
+ name
215
+ Name of the team.
216
+
217
+ owner
218
+ Organization owning the team. Defaults to the profile's :ghconf:`owner`.
219
+
220
+ profile
221
+ Profile configuration name to use. Defaults to ``github``.
222
+ """
223
+ return _strip_team_caches(gh_teams.find(_get_conn(profile), name, owner=owner))
224
+
225
+
226
+ def add_team(
227
+ name,
228
+ description=None,
229
+ repo_names=None,
230
+ privacy=None,
231
+ permission=None,
232
+ owner=None,
233
+ profile="github",
234
+ ):
235
+ """
236
+ Create a new team within the organization.
237
+ Returns the details of the created team.
238
+
239
+ CLI Example:
240
+
241
+ .. code-block:: bash
242
+
243
+ salt-call github_org.add_team 'team_name'
244
+
245
+ name
246
+ Name of the team to create.
247
+
248
+ description
249
+ Team description.
250
+
251
+ repo_names
252
+ Names of repositories to add the team to.
253
+
254
+ privacy
255
+ Privacy level for the team, either ``secret`` or ``closed``.
256
+
257
+ permission
258
+ Default permission for new repositories added to the team, either
259
+ ``pull``, ``push`` or ``admin``.
260
+
261
+ owner
262
+ Organization owning the team. Defaults to the profile's :ghconf:`owner`.
263
+
264
+ profile
265
+ Profile configuration name to use. Defaults to ``github``.
266
+ """
267
+ ght = _get_conn(profile).bind(gh_teams)
268
+ ght.create(
269
+ name,
270
+ description=description,
271
+ repo_names=repo_names,
272
+ privacy=privacy,
273
+ permission=permission,
274
+ owner=owner,
275
+ )
276
+ return _strip_team_caches(ght.find(name, owner=owner))
277
+
278
+
279
+ def edit_team(name, description=None, privacy=None, permission=None, owner=None, profile="github"):
280
+ """
281
+ Update an existing team.
282
+ Returns the refreshed team details.
283
+
284
+ CLI Example:
285
+
286
+ .. code-block:: bash
287
+
288
+ salt-call github_org.edit_team 'team_name' description='Team description'
289
+
290
+ name
291
+ Name of the team to edit.
292
+
293
+ description
294
+ Team description.
295
+
296
+ privacy
297
+ Privacy level for the team, either ``secret`` or ``closed``.
298
+
299
+ permission
300
+ Default permission for new repositories added to the team, either
301
+ ``pull``, ``push`` or ``admin``.
302
+
303
+ owner
304
+ Organization owning the team. Defaults to the profile's :ghconf:`owner`.
305
+
306
+ profile
307
+ Profile configuration name to use. Defaults to ``github``.
308
+ """
309
+ ght = _get_conn(profile).bind(gh_teams)
310
+ ght.update(
311
+ ght.find(name, owner=owner),
312
+ name,
313
+ description=description,
314
+ privacy=privacy,
315
+ permission=permission,
316
+ owner=owner,
317
+ )
318
+ return _strip_team_caches(ght.find(name, owner=owner))
319
+
320
+
321
+ def remove_team(name, owner=None, profile="github"):
322
+ """
323
+ Remove a team from the organization.
324
+
325
+ CLI Example:
326
+
327
+ .. code-block:: bash
328
+
329
+ salt-call github_org.remove_team 'team_name'
330
+
331
+ name
332
+ Name of the team to remove.
333
+
334
+ owner
335
+ Organization owning the team. Defaults to the profile's :ghconf:`owner`.
336
+
337
+ profile
338
+ Profile configuration name to use. Defaults to ``github``.
339
+ """
340
+ ght = _get_conn(profile).bind(gh_teams)
341
+ ght.delete(ght.find(name, owner=owner), owner=owner)
342
+ return True
343
+
344
+
345
+ def list_team_repos(team_name, owner=None, fields=None, ignore_cache=False, profile="github"):
346
+ """
347
+ Return the repositories of a team, as a mapping of repository
348
+ name to team-specific details (``permission``).
349
+
350
+ CLI Example:
351
+
352
+ .. code-block:: bash
353
+
354
+ salt-call github_org.list_team_repos 'team_name'
355
+
356
+ team_name
357
+ Name of the team from which to list repos.
358
+
359
+ owner
360
+ Organization owning the team. Defaults to the profile's :ghconf:`owner`.
361
+
362
+ fields
363
+ Only include these fields in the output. A single field name
364
+ reduces each entry to the field's value.
365
+
366
+ ignore_cache
367
+ Bypass the use of cached team repos.
368
+
369
+ profile
370
+ Profile configuration name to use. Defaults to ``github``.
371
+ """
372
+ ght = _get_conn(profile).bind(gh_teams)
373
+ repos = ght.list_repos(ght.find(team_name, owner=owner), owner=owner, ignore_cache=ignore_cache)
374
+ return filter_fields({repo["name"]: repo for repo in repos.values()}, fields)
375
+
376
+
377
+ def add_team_repo(repo_name, team_name, permission=None, owner=None, profile="github"):
378
+ """
379
+ Add a repository to a team, or update the permission the team has
380
+ on it.
381
+
382
+ CLI Example:
383
+
384
+ .. code-block:: bash
385
+
386
+ salt-call github_org.add_team_repo 'my_repo' 'team_name'
387
+
388
+ repo_name
389
+ Name of the repository to add.
390
+
391
+ team_name
392
+ Name of the team to add the repository to.
393
+
394
+ permission
395
+ Permission for team members within the repository, either ``pull``,
396
+ ``push`` or ``admin``. If not specified, the team's default permission is used.
397
+
398
+ owner
399
+ Organization owning the team. Defaults to the profile's :ghconf:`owner`.
400
+
401
+ profile
402
+ Profile configuration name to use. Defaults to ``github``.
403
+ """
404
+ ght = _get_conn(profile).bind(gh_teams)
405
+ ght.add_repo(ght.find(team_name, owner=owner), repo_name, permission=permission, owner=owner)
406
+ return True
407
+
408
+
409
+ def remove_team_repo(repo_name, team_name, owner=None, profile="github"):
410
+ """
411
+ Remove a repository from a team.
412
+
413
+ CLI Example:
414
+
415
+ .. code-block:: bash
416
+
417
+ salt-call github_org.remove_team_repo 'my_repo' 'team_name'
418
+
419
+ repo_name
420
+ Name of the repository to remove.
421
+
422
+ team_name
423
+ Name of the team to remove the repository from.
424
+
425
+ owner
426
+ Organization owning the team. Defaults to the profile's :ghconf:`owner`.
427
+
428
+ profile
429
+ Profile configuration name to use. Defaults to ``github``.
430
+ """
431
+ ght = _get_conn(profile).bind(gh_teams)
432
+ ght.remove_repo(ght.find(team_name, owner=owner), repo_name, owner=owner)
433
+ return True
434
+
435
+
436
+ def list_team_members(team_name, owner=None, ignore_cache=False, profile="github"):
437
+ """
438
+ Return the logins of a team's members, in lower case.
439
+
440
+ CLI Example:
441
+
442
+ .. code-block:: bash
443
+
444
+ salt-call github_org.list_team_members 'team_name'
445
+
446
+ team_name
447
+ Name of the team from which to list members.
448
+
449
+ owner
450
+ Organization owning the team. Defaults to the profile's :ghconf:`owner`.
451
+
452
+ ignore_cache
453
+ Bypass the use of cached team members.
454
+
455
+ profile
456
+ Profile configuration name to use. Defaults to ``github``.
457
+ """
458
+ ght = _get_conn(profile).bind(gh_teams)
459
+ return ght.list_members(
460
+ ght.find(team_name, owner=owner), owner=owner, ignore_cache=ignore_cache
461
+ )
462
+
463
+
464
+ def is_team_member(name, team_name, owner=None, profile="github"):
465
+ """
466
+ Return whether a user is a member of a team.
467
+
468
+ CLI Example:
469
+
470
+ .. code-block:: bash
471
+
472
+ salt-call github_org.is_team_member 'user_name' 'team_name'
473
+
474
+ name
475
+ Login of the user whose membership to check.
476
+
477
+ team_name
478
+ Name of the team to check membership in.
479
+
480
+ owner
481
+ Organization owning the team. Defaults to the profile's :ghconf:`owner`.
482
+
483
+ profile
484
+ Profile configuration name to use. Defaults to ``github``.
485
+ """
486
+ return name.lower() in list_team_members(team_name, owner=owner, profile=profile)
487
+
488
+
489
+ def add_team_member(name, team_name, owner=None, profile="github"):
490
+ """
491
+ Add an organization member to a team.
492
+
493
+ CLI Example:
494
+
495
+ .. code-block:: bash
496
+
497
+ salt-call github_org.add_team_member 'user_name' 'team_name'
498
+
499
+ name
500
+ Login of the user to add.
501
+
502
+ team_name
503
+ Name of the team to add the user to.
504
+
505
+ owner
506
+ Organization owning the team. Defaults to the profile's :ghconf:`owner`.
507
+
508
+ profile
509
+ Profile configuration name to use. Defaults to ``github``.
510
+ """
511
+ ght = _get_conn(profile).bind(gh_teams)
512
+ ght.add_member(ght.find(team_name, owner=owner), name, owner=owner)
513
+ return True
514
+
515
+
516
+ def remove_team_member(name, team_name, owner=None, profile="github"):
517
+ """
518
+ Remove a member from a team.
519
+
520
+ CLI Example:
521
+
522
+ .. code-block:: bash
523
+
524
+ salt-call github_org.remove_team_member 'user_name' 'team_name'
525
+
526
+ name
527
+ Login of the user to remove.
528
+
529
+ team_name
530
+ Name of the team to remove the user from.
531
+
532
+ owner
533
+ Organization owning the team. Defaults to the profile's :ghconf:`owner`.
534
+
535
+ profile
536
+ Profile configuration name to use. Defaults to ``github``.
537
+ """
538
+ ght = _get_conn(profile).bind(gh_teams)
539
+ ght.remove_member(ght.find(team_name, owner=owner), name, owner=owner)
540
+ return True
541
+
542
+
543
+ def list_rulesets(owner=None, per_page=None, fields=None, profile="github"):
544
+ """
545
+ List all rulesets of the organization.
546
+
547
+ CLI Example:
548
+
549
+ .. code-block:: bash
550
+
551
+ salt-call github_org.list_rulesets
552
+
553
+ owner
554
+ Organization to target. Defaults to the profile's ``owner``.
555
+
556
+ per_page
557
+ Pagination size, maximum 100.
558
+
559
+ fields
560
+ Only include these fields in the output. A single field name
561
+ reduces each entry to the field's value.
562
+
563
+ profile
564
+ Profile configuration name to use. Defaults to ``github``.
565
+ """
566
+ conn = _get_conn(profile)
567
+ return filter_fields(
568
+ gh_rulesets.list_all(conn, "org", org_name=owner, per_page=per_page), fields
569
+ )
570
+
571
+
572
+ def get_ruleset(ruleset_id, owner=None, profile="github"):
573
+ """
574
+ Return the data of a single organization ruleset.
575
+
576
+ CLI Example:
577
+
578
+ .. code-block:: bash
579
+
580
+ salt-call github_org.get_ruleset 1234
581
+
582
+ ruleset_id
583
+ ID of the ruleset.
584
+
585
+ owner
586
+ Organization to target. Defaults to the profile's ``owner``.
587
+
588
+ profile
589
+ Profile configuration name to use. Defaults to ``github``.
590
+ """
591
+ conn = _get_conn(profile)
592
+ return gh_rulesets.get(conn, ruleset_id, "org", org_name=owner)
593
+
594
+
595
+ def add_ruleset(ruleset_params, owner=None, profile="github"):
596
+ """
597
+ Create a new organization ruleset.
598
+ Returns the data of the created ruleset.
599
+
600
+ CLI Example:
601
+
602
+ .. code-block:: bash
603
+
604
+ salt-call github_org.add_ruleset '{name: test, enforcement: active}'
605
+
606
+ ruleset_params
607
+ Ruleset definition. Must contain at least ``name`` and ``enforcement``.
608
+
609
+ owner
610
+ Organization to target. Defaults to the profile's ``owner``.
611
+
612
+ profile
613
+ Profile configuration name to use. Defaults to ``github``.
614
+ """
615
+ conn = _get_conn(profile)
616
+ return gh_rulesets.create(conn, ruleset_params, "org", org_name=owner)
617
+
618
+
619
+ def update_ruleset(ruleset_id, ruleset_params, owner=None, profile="github"):
620
+ """
621
+ Update an existing organization ruleset.
622
+ Returns the data of the updated ruleset.
623
+
624
+ CLI Example:
625
+
626
+ .. code-block:: bash
627
+
628
+ salt-call github_org.update_ruleset 1234 '{enforcement: disabled}'
629
+
630
+ ruleset_id
631
+ ID of the ruleset.
632
+
633
+ ruleset_params
634
+ Updated ruleset definition.
635
+
636
+ owner
637
+ Organization to target. Defaults to the profile's ``owner``.
638
+
639
+ profile
640
+ Profile configuration name to use. Defaults to ``github``.
641
+ """
642
+ conn = _get_conn(profile)
643
+ return gh_rulesets.update(conn, ruleset_id, ruleset_params, "org", org_name=owner)
644
+
645
+
646
+ def delete_ruleset(ruleset_id, owner=None, profile="github"):
647
+ """
648
+ Delete an organization ruleset.
649
+
650
+ CLI Example:
651
+
652
+ .. code-block:: bash
653
+
654
+ salt-call github_org.delete_ruleset 1234
655
+
656
+ ruleset_id
657
+ ID of the ruleset.
658
+
659
+ owner
660
+ Organization to target. Defaults to the profile's ``owner``.
661
+
662
+ profile
663
+ Profile configuration name to use. Defaults to ``github``.
664
+ """
665
+ conn = _get_conn(profile)
666
+ gh_rulesets.delete(conn, ruleset_id, "org", org_name=owner)
667
+ return True