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.
- saltext/github/__init__.py +31 -0
- saltext/github/modules/__init__.py +0 -0
- saltext/github/modules/github.py +1873 -0
- saltext/github/modules/github_org.py +667 -0
- saltext/github/modules/github_repo.py +1658 -0
- saltext/github/modules/github_user.py +75 -0
- saltext/github/resources/__init__.py +0 -0
- saltext/github/resources/github/__init__.py +251 -0
- saltext/github/resources/github/modules/__init__.py +0 -0
- saltext/github/resources/github/modules/actions.py +175 -0
- saltext/github/resources/github/modules/config.py +69 -0
- saltext/github/resources/github/modules/deploy_key.py +122 -0
- saltext/github/resources/github/modules/environment.py +241 -0
- saltext/github/resources/github/modules/grains.py +18 -0
- saltext/github/resources/github/modules/issue.py +157 -0
- saltext/github/resources/github/modules/label.py +161 -0
- saltext/github/resources/github/modules/milestone.py +103 -0
- saltext/github/resources/github/modules/pages.py +149 -0
- saltext/github/resources/github/modules/pull.py +90 -0
- saltext/github/resources/github/modules/repo.py +155 -0
- saltext/github/resources/github/modules/ruleset.py +144 -0
- saltext/github/resources/github/modules/saltutil.py +24 -0
- saltext/github/resources/github/modules/state.py +116 -0
- saltext/github/resources/github/modules/test.py +29 -0
- saltext/github/resources/github/states/__init__.py +0 -0
- saltext/github/resources/github/states/actions.py +117 -0
- saltext/github/resources/github/states/deploy_key.py +130 -0
- saltext/github/resources/github/states/environment.py +99 -0
- saltext/github/resources/github/states/label.py +71 -0
- saltext/github/resources/github/states/pages.py +92 -0
- saltext/github/resources/github/states/repo.py +108 -0
- saltext/github/resources/github/states/ruleset.py +81 -0
- saltext/github/states/__init__.py +0 -0
- saltext/github/states/github.py +966 -0
- saltext/github/states/github_org.py +369 -0
- saltext/github/states/github_repo.py +722 -0
- saltext/github/utils/__init__.py +72 -0
- saltext/github/utils/gh/__init__.py +14 -0
- saltext/github/utils/gh/actions.py +195 -0
- saltext/github/utils/gh/cache.py +126 -0
- saltext/github/utils/gh/client.py +534 -0
- saltext/github/utils/gh/deploy_keys.py +121 -0
- saltext/github/utils/gh/environments.py +271 -0
- saltext/github/utils/gh/exceptions.py +28 -0
- saltext/github/utils/gh/grains_files.py +366 -0
- saltext/github/utils/gh/issues.py +193 -0
- saltext/github/utils/gh/labels.py +142 -0
- saltext/github/utils/gh/members.py +157 -0
- saltext/github/utils/gh/milestones.py +122 -0
- saltext/github/utils/gh/pages.py +128 -0
- saltext/github/utils/gh/profile.py +458 -0
- saltext/github/utils/gh/pulls.py +99 -0
- saltext/github/utils/gh/repos.py +465 -0
- saltext/github/utils/gh/resource.py +35 -0
- saltext/github/utils/gh/rulesets.py +191 -0
- saltext/github/utils/gh/statecores/__init__.py +70 -0
- saltext/github/utils/gh/statecores/actions.py +180 -0
- saltext/github/utils/gh/statecores/deploy_keys.py +241 -0
- saltext/github/utils/gh/statecores/environments.py +212 -0
- saltext/github/utils/gh/statecores/labels.py +116 -0
- saltext/github/utils/gh/statecores/pages.py +177 -0
- saltext/github/utils/gh/statecores/repo.py +249 -0
- saltext/github/utils/gh/statecores/rulesets.py +115 -0
- saltext/github/utils/gh/teams.py +375 -0
- saltext/github/utils/gh/users.py +87 -0
- saltext/github/version.py +1 -0
- saltext_github-1.1.0.dist-info/METADATA +151 -0
- saltext_github-1.1.0.dist-info/RECORD +73 -0
- saltext_github-1.1.0.dist-info/WHEEL +5 -0
- saltext_github-1.1.0.dist-info/entry_points.txt +2 -0
- saltext_github-1.1.0.dist-info/licenses/LICENSE +201 -0
- saltext_github-1.1.0.dist-info/licenses/NOTICE +10 -0
- saltext_github-1.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1658 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Manage GitHub repositories within an organization or user account:
|
|
3
|
+
listing and creation as well as, per repository, settings, teams,
|
|
4
|
+
issues, milestones, pull requests, rulesets, deploy keys, Actions
|
|
5
|
+
secrets and settings, environments, labels and Pages.
|
|
6
|
+
|
|
7
|
+
.. versionadded:: 1.1.0
|
|
8
|
+
|
|
9
|
+
Unlike the legacy functions in the :py:mod:`github <saltext.github.modules.github>` module,
|
|
10
|
+
the functions in this module raise errors (usually subclasses of
|
|
11
|
+
:py:class:`CommandExecutionError <salt.exceptions.CommandExecutionError>`)
|
|
12
|
+
instead of logging them and returning ``False``.
|
|
13
|
+
|
|
14
|
+
Collections with a unique natural key (repositories, teams, Actions
|
|
15
|
+
secrets, environments, labels) are returned as mappings keyed by it,
|
|
16
|
+
id-addressed collections (issues, pull requests, milestones, rulesets,
|
|
17
|
+
deploy keys, deployment branch policies) as lists.
|
|
18
|
+
|
|
19
|
+
.. note::
|
|
20
|
+
|
|
21
|
+
This module works on repositories of any owner (organization or
|
|
22
|
+
user): all functions accept an ``owner`` argument that defaults to
|
|
23
|
+
the profile's :ghconf:`owner`. Teams always belong to the owning
|
|
24
|
+
organization, and repository creation (:py:func:`create
|
|
25
|
+
<saltext.github.modules.github_repo.create>`, the creating branch
|
|
26
|
+
of the ``github_repo.present`` state) is only supported for
|
|
27
|
+
organizations and the authenticated user, a GitHub API limitation.
|
|
28
|
+
|
|
29
|
+
:depends: PyGithub python module
|
|
30
|
+
|
|
31
|
+
Configuration
|
|
32
|
+
-------------
|
|
33
|
+
|
|
34
|
+
This module reads its configuration from profiles, which are described
|
|
35
|
+
in the :ref:`configuration guide <github-configuration>`. The
|
|
36
|
+
repository-scoped functions operate on the repository named in
|
|
37
|
+
``repo_name``, which is required unless a default is set in the
|
|
38
|
+
profile (:ghconf:`repo_name`).
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
import logging
|
|
42
|
+
|
|
43
|
+
from salt.exceptions import CommandExecutionError
|
|
44
|
+
|
|
45
|
+
from saltext.github.utils import filter_fields
|
|
46
|
+
from saltext.github.utils.gh import actions as gh_actions
|
|
47
|
+
from saltext.github.utils.gh import deploy_keys as gh_deploy_keys
|
|
48
|
+
from saltext.github.utils.gh import environments as gh_environments
|
|
49
|
+
from saltext.github.utils.gh import issues as gh_issues
|
|
50
|
+
from saltext.github.utils.gh import labels as gh_labels
|
|
51
|
+
from saltext.github.utils.gh import milestones as gh_milestones
|
|
52
|
+
from saltext.github.utils.gh import pages as gh_pages
|
|
53
|
+
from saltext.github.utils.gh import profile as gh_profile
|
|
54
|
+
from saltext.github.utils.gh import pulls as gh_pulls
|
|
55
|
+
from saltext.github.utils.gh import repos as gh_repos
|
|
56
|
+
from saltext.github.utils.gh import rulesets as gh_rulesets
|
|
57
|
+
|
|
58
|
+
log = logging.getLogger(__name__)
|
|
59
|
+
|
|
60
|
+
__virtualname__ = "github_repo"
|
|
61
|
+
__func_alias__ = {"list_": "list"}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _get_config_value(profile, config_name):
|
|
65
|
+
return gh_profile.get_config_value(profile, config_name, opts=__opts__, context=__context__)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _get_conn(profile):
|
|
69
|
+
return gh_profile.get_conn(profile, opts=__opts__, context=__context__)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def _get_conn_repo(profile, repo_name) -> tuple[object, str]:
|
|
73
|
+
return _get_conn(profile), repo_name or _get_config_value(profile, "repo_name")
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def list_(private=None, owner=None, fields=None, ignore_cache=False, profile="github"):
|
|
77
|
+
"""
|
|
78
|
+
List all repositories of an owner the profile token can see, as a
|
|
79
|
+
mapping of repository name to details.
|
|
80
|
+
|
|
81
|
+
CLI Example:
|
|
82
|
+
|
|
83
|
+
.. code-block:: bash
|
|
84
|
+
|
|
85
|
+
salt-call github_repo.list
|
|
86
|
+
salt-call github_repo.list private=true
|
|
87
|
+
|
|
88
|
+
private
|
|
89
|
+
Only list private (``true``) or public (``false``) repositories.
|
|
90
|
+
By default, all repositories are listed.
|
|
91
|
+
|
|
92
|
+
owner
|
|
93
|
+
Owner (organization or user) whose repositories to list.
|
|
94
|
+
Defaults to the profile's :ghconf:`owner`. Private repositories of
|
|
95
|
+
users other than the authenticated one are not visible.
|
|
96
|
+
|
|
97
|
+
fields
|
|
98
|
+
Only include these fields in the output. A single field name
|
|
99
|
+
reduces each entry to the field's value.
|
|
100
|
+
|
|
101
|
+
ignore_cache
|
|
102
|
+
Bypass the use of cached repositories.
|
|
103
|
+
|
|
104
|
+
profile
|
|
105
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
106
|
+
"""
|
|
107
|
+
return filter_fields(
|
|
108
|
+
{
|
|
109
|
+
repo.name: gh_repos.to_dict(repo)
|
|
110
|
+
for repo in gh_repos.list_all(
|
|
111
|
+
_get_conn(profile), owner=owner, ignore_cache=ignore_cache
|
|
112
|
+
)
|
|
113
|
+
if private is None or repo.private is private
|
|
114
|
+
},
|
|
115
|
+
fields,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def create(
|
|
120
|
+
repo_name=None,
|
|
121
|
+
description=None,
|
|
122
|
+
homepage=None,
|
|
123
|
+
private=None,
|
|
124
|
+
has_issues=None,
|
|
125
|
+
has_wiki=None,
|
|
126
|
+
has_downloads=None,
|
|
127
|
+
auto_init=None,
|
|
128
|
+
gitignore_template=None,
|
|
129
|
+
license_template=None,
|
|
130
|
+
owner=None,
|
|
131
|
+
profile="github",
|
|
132
|
+
):
|
|
133
|
+
"""
|
|
134
|
+
Create a new repository.
|
|
135
|
+
Returns information about the created repository.
|
|
136
|
+
|
|
137
|
+
CLI Example:
|
|
138
|
+
|
|
139
|
+
.. code-block:: bash
|
|
140
|
+
|
|
141
|
+
salt-call github_repo.create my-repo
|
|
142
|
+
|
|
143
|
+
repo_name
|
|
144
|
+
Name of the repository to create. Defaults to the profile's
|
|
145
|
+
``repo_name``.
|
|
146
|
+
|
|
147
|
+
description
|
|
148
|
+
Repository description.
|
|
149
|
+
|
|
150
|
+
homepage
|
|
151
|
+
URL with more information about the repository, e.g. rendered docs.
|
|
152
|
+
|
|
153
|
+
private
|
|
154
|
+
Repository visibility.
|
|
155
|
+
|
|
156
|
+
has_issues
|
|
157
|
+
Enable issues for this repository.
|
|
158
|
+
|
|
159
|
+
has_wiki
|
|
160
|
+
Enable the wiki for this repository.
|
|
161
|
+
|
|
162
|
+
has_downloads
|
|
163
|
+
Enable downloads for this repository.
|
|
164
|
+
|
|
165
|
+
auto_init
|
|
166
|
+
Create an initial commit with an empty README.
|
|
167
|
+
|
|
168
|
+
gitignore_template
|
|
169
|
+
Desired language or platform for a .gitignore, e.g. "Haskell".
|
|
170
|
+
|
|
171
|
+
license_template
|
|
172
|
+
Desired LICENSE template to apply, e.g. "mit" or "mozilla".
|
|
173
|
+
|
|
174
|
+
owner
|
|
175
|
+
Owner to create the repository for. Defaults to the profile's
|
|
176
|
+
``owner``. The GitHub API only supports creating repositories
|
|
177
|
+
for organizations and the authenticated user.
|
|
178
|
+
|
|
179
|
+
profile
|
|
180
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
181
|
+
"""
|
|
182
|
+
return gh_repos.create(
|
|
183
|
+
*_get_conn_repo(profile, repo_name),
|
|
184
|
+
owner=owner,
|
|
185
|
+
description=description,
|
|
186
|
+
homepage=homepage,
|
|
187
|
+
private=private,
|
|
188
|
+
has_issues=has_issues,
|
|
189
|
+
has_wiki=has_wiki,
|
|
190
|
+
has_downloads=has_downloads,
|
|
191
|
+
auto_init=auto_init,
|
|
192
|
+
gitignore_template=gitignore_template,
|
|
193
|
+
license_template=license_template,
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def info(repo_name=None, owner=None, ignore_cache=False, profile="github"):
|
|
198
|
+
"""
|
|
199
|
+
Return information about a repository.
|
|
200
|
+
|
|
201
|
+
CLI Example:
|
|
202
|
+
|
|
203
|
+
.. code-block:: bash
|
|
204
|
+
|
|
205
|
+
salt-call github_repo.info my-repo
|
|
206
|
+
|
|
207
|
+
repo_name
|
|
208
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
209
|
+
|
|
210
|
+
owner
|
|
211
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
212
|
+
|
|
213
|
+
ignore_cache
|
|
214
|
+
Bypass the use of cached repository information.
|
|
215
|
+
|
|
216
|
+
profile
|
|
217
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
218
|
+
"""
|
|
219
|
+
return gh_repos.get_info(
|
|
220
|
+
*_get_conn_repo(profile, repo_name), owner=owner, ignore_cache=ignore_cache
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def get_teams(repo_name=None, owner=None, fields=None, profile="github"):
|
|
225
|
+
"""
|
|
226
|
+
Return the teams a repository belongs to, as a mapping of team
|
|
227
|
+
name to details.
|
|
228
|
+
|
|
229
|
+
CLI Example:
|
|
230
|
+
|
|
231
|
+
.. code-block:: bash
|
|
232
|
+
|
|
233
|
+
salt-call github_repo.get_teams my-repo
|
|
234
|
+
|
|
235
|
+
repo_name
|
|
236
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
237
|
+
|
|
238
|
+
owner
|
|
239
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
240
|
+
|
|
241
|
+
fields
|
|
242
|
+
Only include these fields in the output. A single field name
|
|
243
|
+
reduces each entry to the field's value.
|
|
244
|
+
|
|
245
|
+
profile
|
|
246
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
247
|
+
"""
|
|
248
|
+
teams = gh_repos.get_teams(*_get_conn_repo(profile, repo_name), owner=owner)
|
|
249
|
+
return filter_fields({team["name"]: team for team in teams}, fields)
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
def update(
|
|
253
|
+
repo_name=None,
|
|
254
|
+
owner=None,
|
|
255
|
+
description=None,
|
|
256
|
+
homepage=None,
|
|
257
|
+
private=None,
|
|
258
|
+
has_issues=None,
|
|
259
|
+
has_wiki=None,
|
|
260
|
+
has_downloads=None,
|
|
261
|
+
default_branch=None,
|
|
262
|
+
profile="github",
|
|
263
|
+
):
|
|
264
|
+
"""
|
|
265
|
+
Update repository settings.
|
|
266
|
+
Returns the refreshed repository information.
|
|
267
|
+
|
|
268
|
+
CLI Example:
|
|
269
|
+
|
|
270
|
+
.. code-block:: bash
|
|
271
|
+
|
|
272
|
+
salt-call github_repo.update my-repo description='Managed by Salt'
|
|
273
|
+
|
|
274
|
+
repo_name
|
|
275
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
276
|
+
|
|
277
|
+
owner
|
|
278
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
279
|
+
|
|
280
|
+
description
|
|
281
|
+
Repository description.
|
|
282
|
+
|
|
283
|
+
homepage
|
|
284
|
+
URL with more information about the repository, e.g. rendered docs.
|
|
285
|
+
|
|
286
|
+
private
|
|
287
|
+
Repository visibility. Changing this requires :ghconf:`allow_repo_privacy_changes`
|
|
288
|
+
to be enabled in the profile.
|
|
289
|
+
|
|
290
|
+
has_issues
|
|
291
|
+
Enable issues for this repository.
|
|
292
|
+
|
|
293
|
+
has_wiki
|
|
294
|
+
Enable the wiki for this repository.
|
|
295
|
+
|
|
296
|
+
has_downloads
|
|
297
|
+
Enable downloads for this repository.
|
|
298
|
+
|
|
299
|
+
default_branch
|
|
300
|
+
Default branch of the repository. Must already exist: Ignored during repo creation.
|
|
301
|
+
|
|
302
|
+
profile
|
|
303
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
304
|
+
"""
|
|
305
|
+
try:
|
|
306
|
+
allow_privacy_change = _get_config_value(profile, "allow_repo_privacy_changes")
|
|
307
|
+
except CommandExecutionError:
|
|
308
|
+
allow_privacy_change = False
|
|
309
|
+
return gh_repos.update(
|
|
310
|
+
*_get_conn_repo(profile, repo_name),
|
|
311
|
+
owner=owner,
|
|
312
|
+
description=description,
|
|
313
|
+
homepage=homepage,
|
|
314
|
+
private=private,
|
|
315
|
+
has_issues=has_issues,
|
|
316
|
+
has_wiki=has_wiki,
|
|
317
|
+
has_downloads=has_downloads,
|
|
318
|
+
default_branch=default_branch,
|
|
319
|
+
allow_privacy_change=allow_privacy_change,
|
|
320
|
+
)
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
def delete(repo_name=None, owner=None, profile="github"):
|
|
324
|
+
"""
|
|
325
|
+
Delete a repository.
|
|
326
|
+
|
|
327
|
+
CLI Example:
|
|
328
|
+
|
|
329
|
+
.. code-block:: bash
|
|
330
|
+
|
|
331
|
+
salt-call github_repo.delete my-repo
|
|
332
|
+
|
|
333
|
+
repo_name
|
|
334
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
335
|
+
|
|
336
|
+
owner
|
|
337
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
338
|
+
|
|
339
|
+
profile
|
|
340
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
341
|
+
"""
|
|
342
|
+
gh_repos.delete(*_get_conn_repo(profile, repo_name), owner=owner)
|
|
343
|
+
return True
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
def list_issues(
|
|
347
|
+
repo_name=None,
|
|
348
|
+
owner=None,
|
|
349
|
+
milestone=None,
|
|
350
|
+
state="open",
|
|
351
|
+
assignee=None,
|
|
352
|
+
creator=None,
|
|
353
|
+
mentioned=None,
|
|
354
|
+
labels=None,
|
|
355
|
+
sort="created",
|
|
356
|
+
direction="desc",
|
|
357
|
+
since=None,
|
|
358
|
+
per_page=None,
|
|
359
|
+
fields=None,
|
|
360
|
+
profile="github",
|
|
361
|
+
):
|
|
362
|
+
"""
|
|
363
|
+
Return the issues in the repository, based on the search options.
|
|
364
|
+
Pull requests are excluded.
|
|
365
|
+
|
|
366
|
+
CLI Example:
|
|
367
|
+
|
|
368
|
+
.. code-block:: bash
|
|
369
|
+
|
|
370
|
+
salt-call github_repo.list_issues my-repo
|
|
371
|
+
|
|
372
|
+
repo_name
|
|
373
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
374
|
+
|
|
375
|
+
owner
|
|
376
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
377
|
+
|
|
378
|
+
milestone
|
|
379
|
+
Number of a GitHub milestone, or a string of either ``*`` or ``none``.
|
|
380
|
+
|
|
381
|
+
state
|
|
382
|
+
Filter returned issues by their state. Can be either ``open``,
|
|
383
|
+
``closed``, or ``all``. Default is ``open``.
|
|
384
|
+
|
|
385
|
+
assignee
|
|
386
|
+
Filter returned issues by assigned user handle. Pass ``none`` (as a string) for issues
|
|
387
|
+
with no assigned user or ``*`` for issues assigned to any user.
|
|
388
|
+
|
|
389
|
+
creator
|
|
390
|
+
Filter by the username that created the issue.
|
|
391
|
+
|
|
392
|
+
mentioned
|
|
393
|
+
Filter issues for a user that's mentioned in the issue.
|
|
394
|
+
|
|
395
|
+
labels
|
|
396
|
+
Filter issues by associated labels. String of comma separated label names.
|
|
397
|
+
For example, ``bug,ui,@high``.
|
|
398
|
+
|
|
399
|
+
sort
|
|
400
|
+
Field to sort results by. Either ``created``, ``updated``, or
|
|
401
|
+
``comments``. Default is ``created``.
|
|
402
|
+
|
|
403
|
+
direction
|
|
404
|
+
Sort direction. Either ``asc`` or ``desc``. Default is ``desc``.
|
|
405
|
+
|
|
406
|
+
since
|
|
407
|
+
Only list issues updated at or after this time. This is a
|
|
408
|
+
timestamp in ISO 8601 format: ``YYYY-MM-DDTHH:MM:SSZ``.
|
|
409
|
+
|
|
410
|
+
per_page
|
|
411
|
+
Pagination size, maximum 100.
|
|
412
|
+
|
|
413
|
+
fields
|
|
414
|
+
Only include these fields in the output. A single field name
|
|
415
|
+
reduces each entry to the field's value.
|
|
416
|
+
|
|
417
|
+
profile
|
|
418
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
419
|
+
"""
|
|
420
|
+
issues = gh_issues.list_all(
|
|
421
|
+
*_get_conn_repo(profile, repo_name),
|
|
422
|
+
milestone=milestone,
|
|
423
|
+
state=state,
|
|
424
|
+
assignee=assignee,
|
|
425
|
+
creator=creator,
|
|
426
|
+
mentioned=mentioned,
|
|
427
|
+
labels=labels,
|
|
428
|
+
sort=sort,
|
|
429
|
+
direction=direction,
|
|
430
|
+
since=since,
|
|
431
|
+
per_page=per_page,
|
|
432
|
+
owner=owner,
|
|
433
|
+
)
|
|
434
|
+
return filter_fields(issues, fields)
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
def get_issue(number, repo_name=None, owner=None, profile="github"):
|
|
438
|
+
"""
|
|
439
|
+
Return information about a single issue in the repository.
|
|
440
|
+
|
|
441
|
+
CLI Example:
|
|
442
|
+
|
|
443
|
+
.. code-block:: bash
|
|
444
|
+
|
|
445
|
+
salt-call github_repo.get_issue 514
|
|
446
|
+
|
|
447
|
+
number
|
|
448
|
+
Issue number to retrieve.
|
|
449
|
+
|
|
450
|
+
repo_name
|
|
451
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
452
|
+
|
|
453
|
+
owner
|
|
454
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
455
|
+
|
|
456
|
+
profile
|
|
457
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
458
|
+
"""
|
|
459
|
+
return gh_issues.get(*_get_conn_repo(profile, repo_name), number, owner=owner)
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
def get_issue_comments(number, repo_name=None, owner=None, since=None, profile="github"):
|
|
463
|
+
"""
|
|
464
|
+
Return the comments of an issue in the repository.
|
|
465
|
+
|
|
466
|
+
CLI Example:
|
|
467
|
+
|
|
468
|
+
.. code-block:: bash
|
|
469
|
+
|
|
470
|
+
salt-call github_repo.get_issue_comments 514
|
|
471
|
+
|
|
472
|
+
number
|
|
473
|
+
Issue number for which to retrieve comments.
|
|
474
|
+
|
|
475
|
+
repo_name
|
|
476
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
477
|
+
|
|
478
|
+
owner
|
|
479
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
480
|
+
|
|
481
|
+
since
|
|
482
|
+
Only return comments updated at or after this time. This is a
|
|
483
|
+
timestamp in ISO 8601 format: ``YYYY-MM-DDTHH:MM:SSZ``.
|
|
484
|
+
|
|
485
|
+
profile
|
|
486
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
487
|
+
"""
|
|
488
|
+
return gh_issues.get_comments(
|
|
489
|
+
*_get_conn_repo(profile, repo_name), number, since=since, owner=owner
|
|
490
|
+
)
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
def list_milestones(
|
|
494
|
+
repo_name=None,
|
|
495
|
+
owner=None,
|
|
496
|
+
state="open",
|
|
497
|
+
sort="due_on",
|
|
498
|
+
direction="asc",
|
|
499
|
+
per_page=None,
|
|
500
|
+
fields=None,
|
|
501
|
+
profile="github",
|
|
502
|
+
):
|
|
503
|
+
"""
|
|
504
|
+
Return the existing repository milestones.
|
|
505
|
+
|
|
506
|
+
CLI Example:
|
|
507
|
+
|
|
508
|
+
.. code-block:: bash
|
|
509
|
+
|
|
510
|
+
salt-call github_repo.list_milestones my-repo
|
|
511
|
+
|
|
512
|
+
repo_name
|
|
513
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
514
|
+
|
|
515
|
+
owner
|
|
516
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
517
|
+
|
|
518
|
+
state
|
|
519
|
+
Filter milestones by their state. Either ``open``, ``closed``, or ``all``.
|
|
520
|
+
Default is ``open``.
|
|
521
|
+
|
|
522
|
+
sort
|
|
523
|
+
Field to sort results by. Either ``due_on`` or ``completeness``. Default
|
|
524
|
+
is ``due_on``.
|
|
525
|
+
|
|
526
|
+
direction
|
|
527
|
+
Sort direction. Either ``asc`` or ``desc``. Default is ``asc``.
|
|
528
|
+
|
|
529
|
+
per_page
|
|
530
|
+
Pagination size, maximum 100.
|
|
531
|
+
|
|
532
|
+
fields
|
|
533
|
+
Only include these fields in the output. A single field name
|
|
534
|
+
reduces each entry to the field's value.
|
|
535
|
+
|
|
536
|
+
profile
|
|
537
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
538
|
+
"""
|
|
539
|
+
milestones = gh_milestones.list_all(
|
|
540
|
+
*_get_conn_repo(profile, repo_name),
|
|
541
|
+
state=state,
|
|
542
|
+
sort=sort,
|
|
543
|
+
direction=direction,
|
|
544
|
+
per_page=per_page,
|
|
545
|
+
owner=owner,
|
|
546
|
+
)
|
|
547
|
+
return filter_fields(milestones, fields)
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
def get_milestone(number=None, name=None, repo_name=None, owner=None, profile="github"):
|
|
551
|
+
"""
|
|
552
|
+
Return information about a single milestone in the repository.
|
|
553
|
+
|
|
554
|
+
CLI Example:
|
|
555
|
+
|
|
556
|
+
.. code-block:: bash
|
|
557
|
+
|
|
558
|
+
salt-call github_repo.get_milestone 72
|
|
559
|
+
salt-call github_repo.get_milestone name=my_milestone
|
|
560
|
+
|
|
561
|
+
number
|
|
562
|
+
Milestone number to retrieve. If provided, overrides ``name``.
|
|
563
|
+
|
|
564
|
+
name
|
|
565
|
+
Title of the milestone to retrieve.
|
|
566
|
+
|
|
567
|
+
repo_name
|
|
568
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
569
|
+
|
|
570
|
+
owner
|
|
571
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
572
|
+
|
|
573
|
+
profile
|
|
574
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
575
|
+
"""
|
|
576
|
+
if not (number or name):
|
|
577
|
+
raise CommandExecutionError("Either a milestone 'name' or 'number' must be provided.")
|
|
578
|
+
|
|
579
|
+
if number:
|
|
580
|
+
return gh_milestones.get(*_get_conn_repo(profile, repo_name), number, owner=owner)
|
|
581
|
+
return gh_milestones.find_by_title(*_get_conn_repo(profile, repo_name), name, owner=owner)
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
def list_pulls(
|
|
585
|
+
repo_name=None,
|
|
586
|
+
owner=None,
|
|
587
|
+
state="open",
|
|
588
|
+
head=None,
|
|
589
|
+
base=None,
|
|
590
|
+
sort="created",
|
|
591
|
+
direction="desc",
|
|
592
|
+
per_page=None,
|
|
593
|
+
fields=None,
|
|
594
|
+
profile="github",
|
|
595
|
+
):
|
|
596
|
+
"""
|
|
597
|
+
Return the pull requests in the repository, based on the search options.
|
|
598
|
+
|
|
599
|
+
CLI Example:
|
|
600
|
+
|
|
601
|
+
.. code-block:: bash
|
|
602
|
+
|
|
603
|
+
salt-call github_repo.list_pulls my-repo
|
|
604
|
+
|
|
605
|
+
repo_name
|
|
606
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
607
|
+
|
|
608
|
+
owner
|
|
609
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
610
|
+
|
|
611
|
+
state
|
|
612
|
+
Filter returned pull requests by their state. Can be either
|
|
613
|
+
``open``, ``closed``, or ``all``. Default is ``open``.
|
|
614
|
+
|
|
615
|
+
head
|
|
616
|
+
Filter pull requests by head user and branch name in the format
|
|
617
|
+
``user:ref-name``.
|
|
618
|
+
|
|
619
|
+
base
|
|
620
|
+
Filter pulls by base branch name, e.g. ``gh-pages``.
|
|
621
|
+
|
|
622
|
+
sort
|
|
623
|
+
Field to sort results by. Either ``created``, ``updated``,
|
|
624
|
+
``popularity`` (comment count), or ``long-running`` (age, filtering
|
|
625
|
+
by pull requests updated within the last month). Default is ``created``.
|
|
626
|
+
|
|
627
|
+
direction
|
|
628
|
+
Sort direction. Either ``asc`` or ``desc``. Default is ``desc``.
|
|
629
|
+
|
|
630
|
+
per_page
|
|
631
|
+
Pagination size, maximum 100.
|
|
632
|
+
|
|
633
|
+
fields
|
|
634
|
+
Only include these fields in the output. A single field name
|
|
635
|
+
reduces each entry to the field's value.
|
|
636
|
+
|
|
637
|
+
profile
|
|
638
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
639
|
+
"""
|
|
640
|
+
pulls = gh_pulls.list_all(
|
|
641
|
+
*_get_conn_repo(profile, repo_name),
|
|
642
|
+
state=state,
|
|
643
|
+
head=head,
|
|
644
|
+
base=base,
|
|
645
|
+
sort=sort,
|
|
646
|
+
direction=direction,
|
|
647
|
+
per_page=per_page,
|
|
648
|
+
owner=owner,
|
|
649
|
+
)
|
|
650
|
+
return filter_fields(pulls, fields)
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
def list_rulesets(repo_name=None, owner=None, per_page=None, fields=None, profile="github"):
|
|
654
|
+
"""
|
|
655
|
+
List all rulesets of the repository.
|
|
656
|
+
|
|
657
|
+
CLI Example:
|
|
658
|
+
|
|
659
|
+
.. code-block:: bash
|
|
660
|
+
|
|
661
|
+
salt-call github_repo.list_rulesets my-repo
|
|
662
|
+
|
|
663
|
+
repo_name
|
|
664
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
665
|
+
|
|
666
|
+
owner
|
|
667
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
668
|
+
|
|
669
|
+
per_page
|
|
670
|
+
Pagination size, maximum 100.
|
|
671
|
+
|
|
672
|
+
fields
|
|
673
|
+
Only include these fields in the output. A single field name
|
|
674
|
+
reduces each entry to the field's value.
|
|
675
|
+
|
|
676
|
+
profile
|
|
677
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
678
|
+
"""
|
|
679
|
+
conn, repo_name = _get_conn_repo(profile, repo_name)
|
|
680
|
+
rulesets = gh_rulesets.list_all(
|
|
681
|
+
conn,
|
|
682
|
+
"repo",
|
|
683
|
+
owner=owner,
|
|
684
|
+
repo_name=repo_name,
|
|
685
|
+
per_page=per_page,
|
|
686
|
+
)
|
|
687
|
+
return filter_fields(rulesets, fields)
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
def get_ruleset(ruleset_id, repo_name=None, owner=None, profile="github"):
|
|
691
|
+
"""
|
|
692
|
+
Return the data of a single repository ruleset.
|
|
693
|
+
|
|
694
|
+
CLI Example:
|
|
695
|
+
|
|
696
|
+
.. code-block:: bash
|
|
697
|
+
|
|
698
|
+
salt-call github_repo.get_ruleset 1234 repo_name=my-repo
|
|
699
|
+
|
|
700
|
+
ruleset_id
|
|
701
|
+
ID of the ruleset.
|
|
702
|
+
|
|
703
|
+
repo_name
|
|
704
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
705
|
+
|
|
706
|
+
owner
|
|
707
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
708
|
+
|
|
709
|
+
profile
|
|
710
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
711
|
+
"""
|
|
712
|
+
conn, repo_name = _get_conn_repo(profile, repo_name)
|
|
713
|
+
return gh_rulesets.get(conn, ruleset_id, "repo", owner=owner, repo_name=repo_name)
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
def add_ruleset(ruleset_params, repo_name=None, owner=None, profile="github"):
|
|
717
|
+
"""
|
|
718
|
+
Create a new repository ruleset.
|
|
719
|
+
Returns the data of the created ruleset.
|
|
720
|
+
|
|
721
|
+
CLI Example:
|
|
722
|
+
|
|
723
|
+
.. code-block:: bash
|
|
724
|
+
|
|
725
|
+
salt-call github_repo.add_ruleset '{name: test, enforcement: active}' repo_name=my-repo
|
|
726
|
+
|
|
727
|
+
ruleset_params
|
|
728
|
+
Ruleset definition. Must contain at least ``name`` and ``enforcement``.
|
|
729
|
+
|
|
730
|
+
repo_name
|
|
731
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
732
|
+
|
|
733
|
+
owner
|
|
734
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
735
|
+
|
|
736
|
+
profile
|
|
737
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
738
|
+
"""
|
|
739
|
+
conn, repo_name = _get_conn_repo(profile, repo_name)
|
|
740
|
+
return gh_rulesets.create(conn, ruleset_params, "repo", owner=owner, repo_name=repo_name)
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
def update_ruleset(ruleset_id, ruleset_params, repo_name=None, owner=None, profile="github"):
|
|
744
|
+
"""
|
|
745
|
+
Update an existing repository ruleset.
|
|
746
|
+
Returns the data of the updated ruleset.
|
|
747
|
+
|
|
748
|
+
CLI Example:
|
|
749
|
+
|
|
750
|
+
.. code-block:: bash
|
|
751
|
+
|
|
752
|
+
salt-call github_repo.update_ruleset 1234 '{enforcement: disabled}' repo_name=my-repo
|
|
753
|
+
|
|
754
|
+
ruleset_id
|
|
755
|
+
ID of the ruleset.
|
|
756
|
+
|
|
757
|
+
ruleset_params
|
|
758
|
+
Updated ruleset definition.
|
|
759
|
+
|
|
760
|
+
repo_name
|
|
761
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
762
|
+
|
|
763
|
+
owner
|
|
764
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
765
|
+
|
|
766
|
+
profile
|
|
767
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
768
|
+
"""
|
|
769
|
+
conn, repo_name = _get_conn_repo(profile, repo_name)
|
|
770
|
+
return gh_rulesets.update(
|
|
771
|
+
conn,
|
|
772
|
+
ruleset_id,
|
|
773
|
+
ruleset_params,
|
|
774
|
+
"repo",
|
|
775
|
+
owner=owner,
|
|
776
|
+
repo_name=repo_name,
|
|
777
|
+
)
|
|
778
|
+
|
|
779
|
+
|
|
780
|
+
def delete_ruleset(ruleset_id, repo_name=None, owner=None, profile="github"):
|
|
781
|
+
"""
|
|
782
|
+
Delete a repository ruleset.
|
|
783
|
+
|
|
784
|
+
CLI Example:
|
|
785
|
+
|
|
786
|
+
.. code-block:: bash
|
|
787
|
+
|
|
788
|
+
salt-call github_repo.delete_ruleset 1234 repo_name=my-repo
|
|
789
|
+
|
|
790
|
+
ruleset_id
|
|
791
|
+
ID of the ruleset.
|
|
792
|
+
|
|
793
|
+
repo_name
|
|
794
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
795
|
+
|
|
796
|
+
owner
|
|
797
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
798
|
+
|
|
799
|
+
profile
|
|
800
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
801
|
+
"""
|
|
802
|
+
conn, repo_name = _get_conn_repo(profile, repo_name)
|
|
803
|
+
gh_rulesets.delete(conn, ruleset_id, "repo", owner=owner, repo_name=repo_name)
|
|
804
|
+
return True
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
def list_deploy_keys(repo_name=None, owner=None, fields=None, profile="github"):
|
|
808
|
+
"""
|
|
809
|
+
List the deploy keys of a repository.
|
|
810
|
+
|
|
811
|
+
CLI Example:
|
|
812
|
+
|
|
813
|
+
.. code-block:: bash
|
|
814
|
+
|
|
815
|
+
salt-call github_repo.list_deploy_keys my-repo
|
|
816
|
+
|
|
817
|
+
repo_name
|
|
818
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
819
|
+
|
|
820
|
+
owner
|
|
821
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
822
|
+
|
|
823
|
+
fields
|
|
824
|
+
Only include these fields in the output. A single field name
|
|
825
|
+
reduces each entry to the field's value.
|
|
826
|
+
|
|
827
|
+
profile
|
|
828
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
829
|
+
"""
|
|
830
|
+
return filter_fields(
|
|
831
|
+
gh_deploy_keys.list_all(*_get_conn_repo(profile, repo_name), owner=owner), fields
|
|
832
|
+
)
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
def get_deploy_key(key_id, repo_name=None, owner=None, profile="github"):
|
|
836
|
+
"""
|
|
837
|
+
Return the data of a single deploy key of a repository.
|
|
838
|
+
|
|
839
|
+
CLI Example:
|
|
840
|
+
|
|
841
|
+
.. code-block:: bash
|
|
842
|
+
|
|
843
|
+
salt-call github_repo.get_deploy_key 12345 repo_name=my-repo
|
|
844
|
+
|
|
845
|
+
key_id
|
|
846
|
+
ID of the deploy key.
|
|
847
|
+
|
|
848
|
+
repo_name
|
|
849
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
850
|
+
|
|
851
|
+
owner
|
|
852
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
853
|
+
|
|
854
|
+
profile
|
|
855
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
856
|
+
"""
|
|
857
|
+
return gh_deploy_keys.get(*_get_conn_repo(profile, repo_name), key_id, owner=owner)
|
|
858
|
+
|
|
859
|
+
|
|
860
|
+
def add_deploy_key(title, key, read_only=False, repo_name=None, owner=None, profile="github"):
|
|
861
|
+
"""
|
|
862
|
+
Add a deploy key to a repository. Returns the data of the created key.
|
|
863
|
+
|
|
864
|
+
.. note::
|
|
865
|
+
Deploy keys are immutable. To modify one, remove it and add a replacement.
|
|
866
|
+
|
|
867
|
+
CLI Example:
|
|
868
|
+
|
|
869
|
+
.. code-block:: bash
|
|
870
|
+
|
|
871
|
+
salt-call github_repo.add_deploy_key autorelease 'ssh-ed25519 AAAA...' read_only=false repo_name=my-repo
|
|
872
|
+
|
|
873
|
+
title
|
|
874
|
+
Display title of the deploy key.
|
|
875
|
+
|
|
876
|
+
key
|
|
877
|
+
SSH public key.
|
|
878
|
+
|
|
879
|
+
read_only
|
|
880
|
+
Deny write access to the repository for this key. Defaults to false.
|
|
881
|
+
|
|
882
|
+
repo_name
|
|
883
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
884
|
+
|
|
885
|
+
owner
|
|
886
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
887
|
+
|
|
888
|
+
profile
|
|
889
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
890
|
+
"""
|
|
891
|
+
return gh_deploy_keys.create(
|
|
892
|
+
*_get_conn_repo(profile, repo_name), title, key, read_only=bool(read_only), owner=owner
|
|
893
|
+
)
|
|
894
|
+
|
|
895
|
+
|
|
896
|
+
def remove_deploy_key(key_id, repo_name=None, owner=None, profile="github"):
|
|
897
|
+
"""
|
|
898
|
+
Remove a deploy key from a repository.
|
|
899
|
+
|
|
900
|
+
CLI Example:
|
|
901
|
+
|
|
902
|
+
.. code-block:: bash
|
|
903
|
+
|
|
904
|
+
salt-call github_repo.remove_deploy_key 12345 repo_name=my-repo
|
|
905
|
+
|
|
906
|
+
key_id
|
|
907
|
+
ID of the deploy key.
|
|
908
|
+
|
|
909
|
+
repo_name
|
|
910
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
911
|
+
|
|
912
|
+
owner
|
|
913
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
914
|
+
|
|
915
|
+
profile
|
|
916
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
917
|
+
"""
|
|
918
|
+
gh_deploy_keys.delete(*_get_conn_repo(profile, repo_name), key_id, owner=owner)
|
|
919
|
+
return True
|
|
920
|
+
|
|
921
|
+
|
|
922
|
+
def list_actions_secrets(repo_name=None, owner=None, fields=None, profile="github"):
|
|
923
|
+
"""
|
|
924
|
+
List the Actions secrets of a repository, as a mapping of secret
|
|
925
|
+
name to metadata. Secret values are write-only, so this only returns
|
|
926
|
+
metadata (``created_at``, ``updated_at``).
|
|
927
|
+
|
|
928
|
+
CLI Example:
|
|
929
|
+
|
|
930
|
+
.. code-block:: bash
|
|
931
|
+
|
|
932
|
+
salt-call github_repo.list_actions_secrets my-repo
|
|
933
|
+
|
|
934
|
+
repo_name
|
|
935
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
936
|
+
|
|
937
|
+
owner
|
|
938
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
939
|
+
|
|
940
|
+
fields
|
|
941
|
+
Only include these fields in the output. A single field name
|
|
942
|
+
reduces each entry to the field's value.
|
|
943
|
+
|
|
944
|
+
profile
|
|
945
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
946
|
+
"""
|
|
947
|
+
secrets = gh_actions.list_secrets(*_get_conn_repo(profile, repo_name), owner=owner)
|
|
948
|
+
return filter_fields({secret["name"]: secret for secret in secrets}, fields)
|
|
949
|
+
|
|
950
|
+
|
|
951
|
+
def get_actions_secret(name, repo_name=None, owner=None, profile="github"):
|
|
952
|
+
"""
|
|
953
|
+
Return the metadata of a single Actions secret of a repository.
|
|
954
|
+
The value itself is write-only and cannot be retrieved.
|
|
955
|
+
|
|
956
|
+
CLI Example:
|
|
957
|
+
|
|
958
|
+
.. code-block:: bash
|
|
959
|
+
|
|
960
|
+
salt-call github_repo.get_actions_secret MY_SECRET repo_name=my-repo
|
|
961
|
+
|
|
962
|
+
name
|
|
963
|
+
Name of the secret.
|
|
964
|
+
|
|
965
|
+
repo_name
|
|
966
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
967
|
+
|
|
968
|
+
owner
|
|
969
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
970
|
+
|
|
971
|
+
profile
|
|
972
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
973
|
+
"""
|
|
974
|
+
return gh_actions.get_secret(*_get_conn_repo(profile, repo_name), name, owner=owner)
|
|
975
|
+
|
|
976
|
+
|
|
977
|
+
def set_actions_secret(name, value, repo_name=None, owner=None, profile="github"):
|
|
978
|
+
"""
|
|
979
|
+
Create or update an Actions secret of a repository. The value is
|
|
980
|
+
encrypted to the repository public key before leaving the minion.
|
|
981
|
+
|
|
982
|
+
CLI Example:
|
|
983
|
+
|
|
984
|
+
.. code-block:: bash
|
|
985
|
+
|
|
986
|
+
salt-call github_repo.set_actions_secret MY_SECRET hunter2 repo_name=my-repo
|
|
987
|
+
|
|
988
|
+
name
|
|
989
|
+
Name of the secret.
|
|
990
|
+
|
|
991
|
+
value
|
|
992
|
+
Plaintext secret value.
|
|
993
|
+
|
|
994
|
+
repo_name
|
|
995
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
996
|
+
|
|
997
|
+
owner
|
|
998
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
999
|
+
|
|
1000
|
+
profile
|
|
1001
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
1002
|
+
"""
|
|
1003
|
+
gh_actions.set_secret(*_get_conn_repo(profile, repo_name), name, value, owner=owner)
|
|
1004
|
+
return True
|
|
1005
|
+
|
|
1006
|
+
|
|
1007
|
+
def remove_actions_secret(name, repo_name=None, owner=None, profile="github"):
|
|
1008
|
+
"""
|
|
1009
|
+
Remove an Actions secret from a repository.
|
|
1010
|
+
|
|
1011
|
+
CLI Example:
|
|
1012
|
+
|
|
1013
|
+
.. code-block:: bash
|
|
1014
|
+
|
|
1015
|
+
salt-call github_repo.remove_actions_secret MY_SECRET repo_name=my-repo
|
|
1016
|
+
|
|
1017
|
+
name
|
|
1018
|
+
Name of the secret.
|
|
1019
|
+
|
|
1020
|
+
repo_name
|
|
1021
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
1022
|
+
|
|
1023
|
+
owner
|
|
1024
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
1025
|
+
|
|
1026
|
+
profile
|
|
1027
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
1028
|
+
"""
|
|
1029
|
+
gh_actions.delete_secret(*_get_conn_repo(profile, repo_name), name, owner=owner)
|
|
1030
|
+
return True
|
|
1031
|
+
|
|
1032
|
+
|
|
1033
|
+
def get_workflow_permissions(repo_name=None, owner=None, profile="github"):
|
|
1034
|
+
"""
|
|
1035
|
+
Return the default workflow permissions granted to the ``GITHUB_TOKEN``
|
|
1036
|
+
in a repository, a mapping with ``default_workflow_permissions``
|
|
1037
|
+
(``read``/``write``) and ``can_approve_pull_request_reviews``.
|
|
1038
|
+
|
|
1039
|
+
CLI Example:
|
|
1040
|
+
|
|
1041
|
+
.. code-block:: bash
|
|
1042
|
+
|
|
1043
|
+
salt-call github_repo.get_workflow_permissions my-repo
|
|
1044
|
+
|
|
1045
|
+
repo_name
|
|
1046
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
1047
|
+
|
|
1048
|
+
owner
|
|
1049
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
1050
|
+
|
|
1051
|
+
profile
|
|
1052
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
1053
|
+
"""
|
|
1054
|
+
return gh_actions.get_workflow_permissions(*_get_conn_repo(profile, repo_name), owner=owner)
|
|
1055
|
+
|
|
1056
|
+
|
|
1057
|
+
def set_workflow_permissions(
|
|
1058
|
+
default_workflow_permissions=None,
|
|
1059
|
+
can_approve_pull_request_reviews=None,
|
|
1060
|
+
repo_name=None,
|
|
1061
|
+
owner=None,
|
|
1062
|
+
profile="github",
|
|
1063
|
+
):
|
|
1064
|
+
"""
|
|
1065
|
+
Update the default workflow permissions granted to the ``GITHUB_TOKEN``
|
|
1066
|
+
in a repository.
|
|
1067
|
+
|
|
1068
|
+
CLI Example:
|
|
1069
|
+
|
|
1070
|
+
.. code-block:: bash
|
|
1071
|
+
|
|
1072
|
+
salt-call github_repo.set_workflow_permissions read can_approve_pull_request_reviews=true repo_name=my-repo
|
|
1073
|
+
|
|
1074
|
+
default_workflow_permissions
|
|
1075
|
+
Default permissions for the ``GITHUB_TOKEN``, either ``read``
|
|
1076
|
+
or ``write``.
|
|
1077
|
+
|
|
1078
|
+
can_approve_pull_request_reviews
|
|
1079
|
+
Allow GitHub Actions to approve pull requests.
|
|
1080
|
+
|
|
1081
|
+
repo_name
|
|
1082
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
1083
|
+
|
|
1084
|
+
owner
|
|
1085
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
1086
|
+
|
|
1087
|
+
profile
|
|
1088
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
1089
|
+
"""
|
|
1090
|
+
gh_actions.set_workflow_permissions(
|
|
1091
|
+
*_get_conn_repo(profile, repo_name),
|
|
1092
|
+
default_workflow_permissions=default_workflow_permissions,
|
|
1093
|
+
can_approve_pull_request_reviews=can_approve_pull_request_reviews,
|
|
1094
|
+
owner=owner,
|
|
1095
|
+
)
|
|
1096
|
+
return True
|
|
1097
|
+
|
|
1098
|
+
|
|
1099
|
+
def list_environments(repo_name=None, owner=None, fields=None, profile="github"):
|
|
1100
|
+
"""
|
|
1101
|
+
List the environments of a repository, as a mapping of environment
|
|
1102
|
+
name to details.
|
|
1103
|
+
|
|
1104
|
+
CLI Example:
|
|
1105
|
+
|
|
1106
|
+
.. code-block:: bash
|
|
1107
|
+
|
|
1108
|
+
salt-call github_repo.list_environments my-repo
|
|
1109
|
+
|
|
1110
|
+
repo_name
|
|
1111
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
1112
|
+
|
|
1113
|
+
owner
|
|
1114
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
1115
|
+
|
|
1116
|
+
fields
|
|
1117
|
+
Only include these fields in the output. A single field name
|
|
1118
|
+
reduces each entry to the field's value.
|
|
1119
|
+
|
|
1120
|
+
profile
|
|
1121
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
1122
|
+
"""
|
|
1123
|
+
environments = gh_environments.list_all(*_get_conn_repo(profile, repo_name), owner=owner)
|
|
1124
|
+
return filter_fields({env["name"]: env for env in environments}, fields)
|
|
1125
|
+
|
|
1126
|
+
|
|
1127
|
+
def get_environment(name, repo_name=None, owner=None, profile="github"):
|
|
1128
|
+
"""
|
|
1129
|
+
Return the data of a single environment of a repository.
|
|
1130
|
+
|
|
1131
|
+
CLI Example:
|
|
1132
|
+
|
|
1133
|
+
.. code-block:: bash
|
|
1134
|
+
|
|
1135
|
+
salt-call github_repo.get_environment release repo_name=my-repo
|
|
1136
|
+
|
|
1137
|
+
name
|
|
1138
|
+
Name of the environment.
|
|
1139
|
+
|
|
1140
|
+
repo_name
|
|
1141
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
1142
|
+
|
|
1143
|
+
owner
|
|
1144
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
1145
|
+
|
|
1146
|
+
profile
|
|
1147
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
1148
|
+
"""
|
|
1149
|
+
return gh_environments.get(*_get_conn_repo(profile, repo_name), name, owner=owner)
|
|
1150
|
+
|
|
1151
|
+
|
|
1152
|
+
def set_environment(
|
|
1153
|
+
name,
|
|
1154
|
+
wait_timer=None,
|
|
1155
|
+
prevent_self_review=None,
|
|
1156
|
+
reviewers=None,
|
|
1157
|
+
deployment_branch_policy=None,
|
|
1158
|
+
repo_name=None,
|
|
1159
|
+
owner=None,
|
|
1160
|
+
profile="github",
|
|
1161
|
+
):
|
|
1162
|
+
"""
|
|
1163
|
+
Create or update an environment of a repository, replacing its whole
|
|
1164
|
+
configuration. Unspecified settings are reset to their defaults.
|
|
1165
|
+
Returns the data of the environment.
|
|
1166
|
+
|
|
1167
|
+
CLI Example:
|
|
1168
|
+
|
|
1169
|
+
.. code-block:: bash
|
|
1170
|
+
|
|
1171
|
+
salt-call github_repo.set_environment release repo_name=my-repo \\
|
|
1172
|
+
deployment_branch_policy='{protected_branches: false, custom_branch_policies: true}'
|
|
1173
|
+
|
|
1174
|
+
name
|
|
1175
|
+
Name of the environment.
|
|
1176
|
+
|
|
1177
|
+
wait_timer
|
|
1178
|
+
Amount of time to delay a job after it is initially triggered,
|
|
1179
|
+
in minutes.
|
|
1180
|
+
|
|
1181
|
+
prevent_self_review
|
|
1182
|
+
Prevent a user who created a job from approving it.
|
|
1183
|
+
|
|
1184
|
+
reviewers
|
|
1185
|
+
People or teams that may review jobs that reference the
|
|
1186
|
+
environment, as a list of mappings with ``type`` (``User`` or
|
|
1187
|
+
``Team``) and ``id``.
|
|
1188
|
+
|
|
1189
|
+
deployment_branch_policy
|
|
1190
|
+
Type of deployment branch policy for this environment, either
|
|
1191
|
+
``null`` (default) to allow all branches or a mapping with
|
|
1192
|
+
``protected_branches`` and ``custom_branch_policies`` booleans.
|
|
1193
|
+
Branch name patterns for custom policies are managed separately,
|
|
1194
|
+
see :py:func:`github_repo.add_deployment_branch_policy
|
|
1195
|
+
<saltext.github.modules.github_repo.add_deployment_branch_policy>`.
|
|
1196
|
+
|
|
1197
|
+
repo_name
|
|
1198
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
1199
|
+
|
|
1200
|
+
owner
|
|
1201
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
1202
|
+
|
|
1203
|
+
profile
|
|
1204
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
1205
|
+
"""
|
|
1206
|
+
return gh_environments.set_(
|
|
1207
|
+
*_get_conn_repo(profile, repo_name),
|
|
1208
|
+
name,
|
|
1209
|
+
wait_timer=wait_timer,
|
|
1210
|
+
prevent_self_review=prevent_self_review,
|
|
1211
|
+
reviewers=reviewers,
|
|
1212
|
+
deployment_branch_policy=deployment_branch_policy,
|
|
1213
|
+
owner=owner,
|
|
1214
|
+
)
|
|
1215
|
+
|
|
1216
|
+
|
|
1217
|
+
def remove_environment(name, repo_name=None, owner=None, profile="github"):
|
|
1218
|
+
"""
|
|
1219
|
+
Remove an environment from a repository.
|
|
1220
|
+
|
|
1221
|
+
CLI Example:
|
|
1222
|
+
|
|
1223
|
+
.. code-block:: bash
|
|
1224
|
+
|
|
1225
|
+
salt-call github_repo.remove_environment release repo_name=my-repo
|
|
1226
|
+
|
|
1227
|
+
name
|
|
1228
|
+
Name of the environment.
|
|
1229
|
+
|
|
1230
|
+
repo_name
|
|
1231
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
1232
|
+
|
|
1233
|
+
owner
|
|
1234
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
1235
|
+
|
|
1236
|
+
profile
|
|
1237
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
1238
|
+
"""
|
|
1239
|
+
gh_environments.delete(*_get_conn_repo(profile, repo_name), name, owner=owner)
|
|
1240
|
+
return True
|
|
1241
|
+
|
|
1242
|
+
|
|
1243
|
+
def list_deployment_branch_policies(
|
|
1244
|
+
environment, repo_name=None, owner=None, fields=None, profile="github"
|
|
1245
|
+
):
|
|
1246
|
+
"""
|
|
1247
|
+
List the deployment branch policies of an environment.
|
|
1248
|
+
|
|
1249
|
+
CLI Example:
|
|
1250
|
+
|
|
1251
|
+
.. code-block:: bash
|
|
1252
|
+
|
|
1253
|
+
salt-call github_repo.list_deployment_branch_policies release repo_name=my-repo
|
|
1254
|
+
|
|
1255
|
+
environment
|
|
1256
|
+
Name of the environment.
|
|
1257
|
+
|
|
1258
|
+
repo_name
|
|
1259
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
1260
|
+
|
|
1261
|
+
owner
|
|
1262
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
1263
|
+
|
|
1264
|
+
fields
|
|
1265
|
+
Only include these fields in the output. A single field name
|
|
1266
|
+
reduces each entry to the field's value.
|
|
1267
|
+
|
|
1268
|
+
profile
|
|
1269
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
1270
|
+
"""
|
|
1271
|
+
return filter_fields(
|
|
1272
|
+
gh_environments.list_branch_policies(
|
|
1273
|
+
*_get_conn_repo(profile, repo_name), environment, owner=owner
|
|
1274
|
+
),
|
|
1275
|
+
fields,
|
|
1276
|
+
)
|
|
1277
|
+
|
|
1278
|
+
|
|
1279
|
+
def add_deployment_branch_policy(
|
|
1280
|
+
environment, name, typ="branch", repo_name=None, owner=None, profile="github"
|
|
1281
|
+
):
|
|
1282
|
+
"""
|
|
1283
|
+
Add a deployment branch (or tag) policy to an environment.
|
|
1284
|
+
Returns the data of the created policy.
|
|
1285
|
+
|
|
1286
|
+
The environment's ``deployment_branch_policy`` must have ``custom_branch_policies`` enabled.
|
|
1287
|
+
|
|
1288
|
+
CLI Example:
|
|
1289
|
+
|
|
1290
|
+
.. code-block:: bash
|
|
1291
|
+
|
|
1292
|
+
salt-call github_repo.add_deployment_branch_policy release main repo_name=my-repo
|
|
1293
|
+
|
|
1294
|
+
environment
|
|
1295
|
+
Name of the environment.
|
|
1296
|
+
|
|
1297
|
+
name
|
|
1298
|
+
Name pattern that branches (or tags) must match in order to
|
|
1299
|
+
deploy to the environment.
|
|
1300
|
+
|
|
1301
|
+
typ
|
|
1302
|
+
Target of this rule, either ``branch`` or ``tag``.
|
|
1303
|
+
Defaults to ``branch``.
|
|
1304
|
+
|
|
1305
|
+
repo_name
|
|
1306
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
1307
|
+
|
|
1308
|
+
owner
|
|
1309
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
1310
|
+
|
|
1311
|
+
profile
|
|
1312
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
1313
|
+
"""
|
|
1314
|
+
return gh_environments.create_branch_policy(
|
|
1315
|
+
*_get_conn_repo(profile, repo_name), environment, name, typ=typ, owner=owner
|
|
1316
|
+
)
|
|
1317
|
+
|
|
1318
|
+
|
|
1319
|
+
def remove_deployment_branch_policy(
|
|
1320
|
+
environment, policy_id, repo_name=None, owner=None, profile="github"
|
|
1321
|
+
):
|
|
1322
|
+
"""
|
|
1323
|
+
Remove a deployment branch policy from an environment.
|
|
1324
|
+
|
|
1325
|
+
CLI Example:
|
|
1326
|
+
|
|
1327
|
+
.. code-block:: bash
|
|
1328
|
+
|
|
1329
|
+
salt-call github_repo.remove_deployment_branch_policy release 12345 repo_name=my-repo
|
|
1330
|
+
|
|
1331
|
+
environment
|
|
1332
|
+
Name of the environment.
|
|
1333
|
+
|
|
1334
|
+
policy_id
|
|
1335
|
+
ID of the branch policy.
|
|
1336
|
+
|
|
1337
|
+
repo_name
|
|
1338
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
1339
|
+
|
|
1340
|
+
owner
|
|
1341
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
1342
|
+
|
|
1343
|
+
profile
|
|
1344
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
1345
|
+
"""
|
|
1346
|
+
gh_environments.delete_branch_policy(
|
|
1347
|
+
*_get_conn_repo(profile, repo_name), environment, policy_id, owner=owner
|
|
1348
|
+
)
|
|
1349
|
+
return True
|
|
1350
|
+
|
|
1351
|
+
|
|
1352
|
+
def list_labels(repo_name=None, owner=None, fields=None, profile="github"):
|
|
1353
|
+
"""
|
|
1354
|
+
List the labels of a repository, as a mapping of label name
|
|
1355
|
+
to details.
|
|
1356
|
+
|
|
1357
|
+
CLI Example:
|
|
1358
|
+
|
|
1359
|
+
.. code-block:: bash
|
|
1360
|
+
|
|
1361
|
+
salt-call github_repo.list_labels my-repo
|
|
1362
|
+
|
|
1363
|
+
repo_name
|
|
1364
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
1365
|
+
|
|
1366
|
+
owner
|
|
1367
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
1368
|
+
|
|
1369
|
+
fields
|
|
1370
|
+
Only include these fields in the output. A single field name
|
|
1371
|
+
reduces each entry to the field's value.
|
|
1372
|
+
|
|
1373
|
+
profile
|
|
1374
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
1375
|
+
"""
|
|
1376
|
+
labels = gh_labels.list_all(*_get_conn_repo(profile, repo_name), owner=owner)
|
|
1377
|
+
return filter_fields({label["name"]: label for label in labels}, fields)
|
|
1378
|
+
|
|
1379
|
+
|
|
1380
|
+
def get_label(name, repo_name=None, owner=None, profile="github"):
|
|
1381
|
+
"""
|
|
1382
|
+
Return the data of a single label of a repository.
|
|
1383
|
+
|
|
1384
|
+
CLI Example:
|
|
1385
|
+
|
|
1386
|
+
.. code-block:: bash
|
|
1387
|
+
|
|
1388
|
+
salt-call github_repo.get_label bug repo_name=my-repo
|
|
1389
|
+
|
|
1390
|
+
name
|
|
1391
|
+
Name of the label.
|
|
1392
|
+
|
|
1393
|
+
repo_name
|
|
1394
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
1395
|
+
|
|
1396
|
+
owner
|
|
1397
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
1398
|
+
|
|
1399
|
+
profile
|
|
1400
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
1401
|
+
"""
|
|
1402
|
+
return gh_labels.get(*_get_conn_repo(profile, repo_name), name, owner=owner)
|
|
1403
|
+
|
|
1404
|
+
|
|
1405
|
+
def add_label(name, color=None, description=None, repo_name=None, owner=None, profile="github"):
|
|
1406
|
+
"""
|
|
1407
|
+
Create a label in a repository. Returns the data of the created label.
|
|
1408
|
+
|
|
1409
|
+
CLI Example:
|
|
1410
|
+
|
|
1411
|
+
.. code-block:: bash
|
|
1412
|
+
|
|
1413
|
+
salt-call github_repo.add_label release color=00ff00 repo_name=my-repo
|
|
1414
|
+
|
|
1415
|
+
name
|
|
1416
|
+
Name of the label.
|
|
1417
|
+
|
|
1418
|
+
color
|
|
1419
|
+
Hexadecimal color code for the label, without the leading ``#``.
|
|
1420
|
+
If unset, GitHub assigns a random one.
|
|
1421
|
+
|
|
1422
|
+
description
|
|
1423
|
+
Short description of the label.
|
|
1424
|
+
|
|
1425
|
+
repo_name
|
|
1426
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
1427
|
+
|
|
1428
|
+
owner
|
|
1429
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
1430
|
+
|
|
1431
|
+
profile
|
|
1432
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
1433
|
+
"""
|
|
1434
|
+
return gh_labels.create(
|
|
1435
|
+
*_get_conn_repo(profile, repo_name),
|
|
1436
|
+
name,
|
|
1437
|
+
color=color,
|
|
1438
|
+
description=description,
|
|
1439
|
+
owner=owner,
|
|
1440
|
+
)
|
|
1441
|
+
|
|
1442
|
+
|
|
1443
|
+
def edit_label(
|
|
1444
|
+
name, new_name=None, color=None, description=None, repo_name=None, owner=None, profile="github"
|
|
1445
|
+
):
|
|
1446
|
+
"""
|
|
1447
|
+
Update an existing label of a repository.
|
|
1448
|
+
Returns the data of the updated label.
|
|
1449
|
+
|
|
1450
|
+
CLI Example:
|
|
1451
|
+
|
|
1452
|
+
.. code-block:: bash
|
|
1453
|
+
|
|
1454
|
+
salt-call github_repo.edit_label release color=00ff00 repo_name=my-repo
|
|
1455
|
+
|
|
1456
|
+
name
|
|
1457
|
+
Current name of the label.
|
|
1458
|
+
|
|
1459
|
+
new_name
|
|
1460
|
+
New name for the label.
|
|
1461
|
+
|
|
1462
|
+
color
|
|
1463
|
+
Hexadecimal color code for the label, without the leading ``#``.
|
|
1464
|
+
|
|
1465
|
+
description
|
|
1466
|
+
Short description of the label.
|
|
1467
|
+
|
|
1468
|
+
repo_name
|
|
1469
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
1470
|
+
|
|
1471
|
+
owner
|
|
1472
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
1473
|
+
|
|
1474
|
+
profile
|
|
1475
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
1476
|
+
"""
|
|
1477
|
+
return gh_labels.update(
|
|
1478
|
+
*_get_conn_repo(profile, repo_name),
|
|
1479
|
+
name,
|
|
1480
|
+
new_name=new_name,
|
|
1481
|
+
color=color,
|
|
1482
|
+
description=description,
|
|
1483
|
+
owner=owner,
|
|
1484
|
+
)
|
|
1485
|
+
|
|
1486
|
+
|
|
1487
|
+
def remove_label(name, repo_name=None, owner=None, profile="github"):
|
|
1488
|
+
"""
|
|
1489
|
+
Delete a label from a repository.
|
|
1490
|
+
|
|
1491
|
+
CLI Example:
|
|
1492
|
+
|
|
1493
|
+
.. code-block:: bash
|
|
1494
|
+
|
|
1495
|
+
salt-call github_repo.remove_label release repo_name=my-repo
|
|
1496
|
+
|
|
1497
|
+
name
|
|
1498
|
+
Name of the label.
|
|
1499
|
+
|
|
1500
|
+
repo_name
|
|
1501
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
1502
|
+
|
|
1503
|
+
owner
|
|
1504
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
1505
|
+
|
|
1506
|
+
profile
|
|
1507
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
1508
|
+
"""
|
|
1509
|
+
gh_labels.delete(*_get_conn_repo(profile, repo_name), name, owner=owner)
|
|
1510
|
+
return True
|
|
1511
|
+
|
|
1512
|
+
|
|
1513
|
+
def get_pages(repo_name=None, owner=None, profile="github"):
|
|
1514
|
+
"""
|
|
1515
|
+
Return information about the GitHub Pages site of a repository.
|
|
1516
|
+
|
|
1517
|
+
CLI Example:
|
|
1518
|
+
|
|
1519
|
+
.. code-block:: bash
|
|
1520
|
+
|
|
1521
|
+
salt-call github_repo.get_pages my-repo
|
|
1522
|
+
|
|
1523
|
+
repo_name
|
|
1524
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
1525
|
+
|
|
1526
|
+
owner
|
|
1527
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
1528
|
+
|
|
1529
|
+
profile
|
|
1530
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
1531
|
+
"""
|
|
1532
|
+
return gh_pages.get(*_get_conn_repo(profile, repo_name), owner=owner)
|
|
1533
|
+
|
|
1534
|
+
|
|
1535
|
+
def setup_pages(
|
|
1536
|
+
build_type=None,
|
|
1537
|
+
source_branch=None,
|
|
1538
|
+
source_path=None,
|
|
1539
|
+
repo_name=None,
|
|
1540
|
+
owner=None,
|
|
1541
|
+
profile="github",
|
|
1542
|
+
):
|
|
1543
|
+
"""
|
|
1544
|
+
Configure a GitHub Pages site for a repository.
|
|
1545
|
+
Returns the data of the created site.
|
|
1546
|
+
|
|
1547
|
+
CLI Example:
|
|
1548
|
+
|
|
1549
|
+
.. code-block:: bash
|
|
1550
|
+
|
|
1551
|
+
salt-call github_repo.setup_pages build_type=workflow repo_name=my-repo
|
|
1552
|
+
|
|
1553
|
+
build_type
|
|
1554
|
+
Process by which the site is built, either ``legacy``
|
|
1555
|
+
(deploy from a branch) or ``workflow`` (GitHub Actions).
|
|
1556
|
+
|
|
1557
|
+
source_branch
|
|
1558
|
+
For ``legacy`` builds, the repository branch to publish from.
|
|
1559
|
+
|
|
1560
|
+
source_path
|
|
1561
|
+
For ``legacy`` builds, the repository directory to publish from,
|
|
1562
|
+
either ``/`` or ``/docs``.
|
|
1563
|
+
|
|
1564
|
+
repo_name
|
|
1565
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
1566
|
+
|
|
1567
|
+
owner
|
|
1568
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
1569
|
+
|
|
1570
|
+
profile
|
|
1571
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
1572
|
+
"""
|
|
1573
|
+
return gh_pages.create(
|
|
1574
|
+
*_get_conn_repo(profile, repo_name),
|
|
1575
|
+
build_type=build_type,
|
|
1576
|
+
source=gh_pages.build_source(source_branch, source_path),
|
|
1577
|
+
owner=owner,
|
|
1578
|
+
)
|
|
1579
|
+
|
|
1580
|
+
|
|
1581
|
+
def update_pages(
|
|
1582
|
+
build_type=None,
|
|
1583
|
+
source_branch=None,
|
|
1584
|
+
source_path=None,
|
|
1585
|
+
cname=...,
|
|
1586
|
+
https_enforced=None,
|
|
1587
|
+
repo_name=None,
|
|
1588
|
+
owner=None,
|
|
1589
|
+
profile="github",
|
|
1590
|
+
):
|
|
1591
|
+
"""
|
|
1592
|
+
Update the GitHub Pages site configuration of a repository.
|
|
1593
|
+
|
|
1594
|
+
CLI Example:
|
|
1595
|
+
|
|
1596
|
+
.. code-block:: bash
|
|
1597
|
+
|
|
1598
|
+
salt-call github_repo.update_pages build_type=workflow repo_name=my-repo
|
|
1599
|
+
|
|
1600
|
+
build_type
|
|
1601
|
+
Process by which the site is built, either ``legacy``
|
|
1602
|
+
(deploy from a branch) or ``workflow`` (GitHub Actions).
|
|
1603
|
+
|
|
1604
|
+
source_branch
|
|
1605
|
+
For ``legacy`` builds, the repository branch to publish from.
|
|
1606
|
+
|
|
1607
|
+
source_path
|
|
1608
|
+
For ``legacy`` builds, the repository directory to publish from,
|
|
1609
|
+
either ``/`` or ``/docs``.
|
|
1610
|
+
|
|
1611
|
+
cname
|
|
1612
|
+
Custom domain for the site. Pass ``null`` explicitly to remove it,
|
|
1613
|
+
omit to leave it unchanged.
|
|
1614
|
+
|
|
1615
|
+
https_enforced
|
|
1616
|
+
Enforce HTTPS for the site.
|
|
1617
|
+
|
|
1618
|
+
repo_name
|
|
1619
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
1620
|
+
|
|
1621
|
+
owner
|
|
1622
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
1623
|
+
|
|
1624
|
+
profile
|
|
1625
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
1626
|
+
"""
|
|
1627
|
+
gh_pages.update(
|
|
1628
|
+
*_get_conn_repo(profile, repo_name),
|
|
1629
|
+
build_type=build_type,
|
|
1630
|
+
source=gh_pages.build_source(source_branch, source_path),
|
|
1631
|
+
cname=cname,
|
|
1632
|
+
https_enforced=https_enforced,
|
|
1633
|
+
owner=owner,
|
|
1634
|
+
)
|
|
1635
|
+
return True
|
|
1636
|
+
|
|
1637
|
+
|
|
1638
|
+
def remove_pages(repo_name=None, owner=None, profile="github"):
|
|
1639
|
+
"""
|
|
1640
|
+
Delete the GitHub Pages site of a repository.
|
|
1641
|
+
|
|
1642
|
+
CLI Example:
|
|
1643
|
+
|
|
1644
|
+
.. code-block:: bash
|
|
1645
|
+
|
|
1646
|
+
salt-call github_repo.remove_pages my-repo
|
|
1647
|
+
|
|
1648
|
+
repo_name
|
|
1649
|
+
Name of the repository. Defaults to the profile's :ghconf:`repo_name`.
|
|
1650
|
+
|
|
1651
|
+
owner
|
|
1652
|
+
Owner of the repository. Defaults to the profile's :ghconf:`owner`.
|
|
1653
|
+
|
|
1654
|
+
profile
|
|
1655
|
+
Profile configuration name to use. Defaults to ``github``.
|
|
1656
|
+
"""
|
|
1657
|
+
gh_pages.delete(*_get_conn_repo(profile, repo_name), owner=owner)
|
|
1658
|
+
return True
|