github-rest-api 0.41.0__tar.gz → 0.42.0__tar.gz
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.
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/PKG-INFO +1 -1
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/github.py +35 -9
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/pyproject.toml +1 -1
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/uv.lock +1 -1
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/.devcontainer/devcontainer.json +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/.github/workflows/create_pr_to_main.yaml +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/.github/workflows/lint.yaml +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/.github/workflows/release.yaml +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/.github/workflows/remove_branch.yaml +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/.github/workflows/test.yaml +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/.gitignore +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/GEMINI.md +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/README.md +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/__init__.py +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/__init__.py +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/cargo/__init__.py +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/cargo/benchmark.py +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/cargo/profiling.py +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/cargo/utils.py +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/container/__init__.py +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/container/build_container_images.py +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/container/config_container.py +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/container/update_version_containerfile.py +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/github/__init__.py +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/github/add_github_repo.py +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/github/create_pull_request.py +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/github/release_on_github.py +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/github/remove_branch.py +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/github/workflows/create_pr_dev_to_main.yaml +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/github/workflows/create_pr_to_dev.yaml +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/github/workflows/create_pr_to_main.yaml +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/github/workflows/python/lint.yaml +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/github/workflows/python/test.yaml +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/github/workflows/remove_branch.yaml +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/utils.py +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/utils.py +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/memory/MEMORY.md +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/memory/feedback_test_runner.md +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/tests/__init__.py +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/tests/test_build_container_images.py +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/tests/test_github.py +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/tests/test_release_on_github.py +0 -0
- {github_rest_api-0.41.0 → github_rest_api-0.42.0}/tests/test_utils.py +0 -0
|
@@ -132,8 +132,19 @@ class GitHub:
|
|
|
132
132
|
return resp
|
|
133
133
|
|
|
134
134
|
def _extract_all(
|
|
135
|
-
self,
|
|
135
|
+
self,
|
|
136
|
+
url: str,
|
|
137
|
+
params: dict[str, Any] | None = None,
|
|
138
|
+
n: int = 0,
|
|
139
|
+
key: str | None = None,
|
|
136
140
|
) -> list[dict[str, Any]]:
|
|
141
|
+
"""Collect all paginated items from a GitHub REST API endpoint.
|
|
142
|
+
:param url: The endpoint URL to request.
|
|
143
|
+
:param params: Query parameters forwarded to each request.
|
|
144
|
+
:param n: The maximum number of items to return (0 means all).
|
|
145
|
+
:param key: The key under which the list is nested in the response.
|
|
146
|
+
Defaults to None for endpoints that return a plain JSON array.
|
|
147
|
+
"""
|
|
137
148
|
params = params.copy() if params else {}
|
|
138
149
|
if "per_page" not in params:
|
|
139
150
|
params["per_page"] = min(100, n) if n > 0 else 100
|
|
@@ -143,10 +154,11 @@ class GitHub:
|
|
|
143
154
|
resp = self._get(url=url, params=params.copy())
|
|
144
155
|
resp.raise_for_status()
|
|
145
156
|
data = resp.json()
|
|
146
|
-
|
|
157
|
+
items = data if key is None else data[key]
|
|
158
|
+
res.extend(items)
|
|
147
159
|
if n and len(res) >= n:
|
|
148
160
|
return res[:n]
|
|
149
|
-
if len(
|
|
161
|
+
if len(items) < params["per_page"]:
|
|
150
162
|
return res
|
|
151
163
|
params["page"] += 1
|
|
152
164
|
|
|
@@ -315,6 +327,10 @@ class Repository(GitHub):
|
|
|
315
327
|
"""
|
|
316
328
|
return self.delete_ref(ref=f"heads/{branch}")
|
|
317
329
|
|
|
330
|
+
def get_secrets(self, n: int = 0) -> list[dict[str, Any]]:
|
|
331
|
+
"""List secrets in this repository."""
|
|
332
|
+
return self._extract_all(url=self._url_secrets, n=n, key="secrets")
|
|
333
|
+
|
|
318
334
|
def delete_secret(self, name: str) -> requests.Response:
|
|
319
335
|
"""Delete a secret from this repository.
|
|
320
336
|
:param name: The name of the secret to delete.
|
|
@@ -328,15 +344,18 @@ class Repository(GitHub):
|
|
|
328
344
|
return self._get(url=f"{self._url_secrets}/public-key").json()
|
|
329
345
|
|
|
330
346
|
def create_or_update_secret(
|
|
331
|
-
self, name: str, value: str, public_key: dict[str, Any]
|
|
347
|
+
self, name: str, value: str, public_key: dict[str, Any] | None = None
|
|
332
348
|
) -> requests.Response:
|
|
333
349
|
"""Create or update a secret in this repository.
|
|
334
350
|
:param name: The name of the secret.
|
|
335
351
|
:param value: The plaintext value of the secret.
|
|
336
352
|
:param public_key: A public key (as returned by `get_secret_public_key`)
|
|
337
|
-
to encrypt the secret with.
|
|
338
|
-
|
|
353
|
+
to encrypt the secret with. If not provided, it is fetched
|
|
354
|
+
automatically. Fetch it once and reuse it to avoid a redundant
|
|
355
|
+
request when creating or updating multiple secrets.
|
|
339
356
|
"""
|
|
357
|
+
if public_key is None:
|
|
358
|
+
public_key = self.get_secret_public_key()
|
|
340
359
|
return self._put(
|
|
341
360
|
url=f"{self._url_secrets}/{name}",
|
|
342
361
|
json={
|
|
@@ -494,6 +513,10 @@ class Organization(Owner):
|
|
|
494
513
|
self._url_create_repo = self._url_repos
|
|
495
514
|
self._url_secrets = f"{self._url_owner}/actions/secrets"
|
|
496
515
|
|
|
516
|
+
def get_secrets(self, n: int = 0) -> list[dict[str, Any]]:
|
|
517
|
+
"""List secrets in this organization."""
|
|
518
|
+
return self._extract_all(url=self._url_secrets, n=n, key="secrets")
|
|
519
|
+
|
|
497
520
|
def delete_secret(self, name: str) -> requests.Response:
|
|
498
521
|
"""Delete an organization secret.
|
|
499
522
|
:param name: The name of the secret to delete.
|
|
@@ -510,7 +533,7 @@ class Organization(Owner):
|
|
|
510
533
|
self,
|
|
511
534
|
name: str,
|
|
512
535
|
value: str,
|
|
513
|
-
public_key: dict[str, Any],
|
|
536
|
+
public_key: dict[str, Any] | None = None,
|
|
514
537
|
visibility: SecretVisibility = SecretVisibility.ALL,
|
|
515
538
|
selected_repository_ids: Sequence[int] = (),
|
|
516
539
|
) -> requests.Response:
|
|
@@ -518,8 +541,9 @@ class Organization(Owner):
|
|
|
518
541
|
:param name: The name of the secret.
|
|
519
542
|
:param value: The plaintext value of the secret.
|
|
520
543
|
:param public_key: A public key (as returned by `get_secret_public_key`)
|
|
521
|
-
to encrypt the secret with.
|
|
522
|
-
|
|
544
|
+
to encrypt the secret with. If not provided, it is fetched
|
|
545
|
+
automatically. Fetch it once and reuse it to avoid a redundant
|
|
546
|
+
request when creating or updating multiple secrets.
|
|
523
547
|
:param visibility: Which repositories can access the secret
|
|
524
548
|
(all, private, or selected).
|
|
525
549
|
:param selected_repository_ids: Repository IDs that can access the secret
|
|
@@ -529,6 +553,8 @@ class Organization(Owner):
|
|
|
529
553
|
raise ValueError(
|
|
530
554
|
"`selected_repository_ids` can only be provided when `visibility` is 'selected'."
|
|
531
555
|
)
|
|
556
|
+
if public_key is None:
|
|
557
|
+
public_key = self.get_secret_public_key()
|
|
532
558
|
json: dict[str, Any] = {
|
|
533
559
|
"encrypted_value": _encrypt_secret(public_key["key"], value),
|
|
534
560
|
"key_id": public_key["key_id"],
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/cargo/benchmark.py
RENAMED
|
File without changes
|
{github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/cargo/profiling.py
RENAMED
|
File without changes
|
|
File without changes
|
{github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/container/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/github/__init__.py
RENAMED
|
File without changes
|
{github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/github/add_github_repo.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{github_rest_api-0.41.0 → github_rest_api-0.42.0}/github_rest_api/scripts/github/remove_branch.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|