github-rest-api 0.35.0__tar.gz → 0.36.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.35.0 → github_rest_api-0.36.0}/.github/workflows/test.yml +2 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/PKG-INFO +1 -1
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/container/update_version_containerfile.py +23 -79
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/pyproject.toml +1 -1
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/tests/test_github.py +6 -9
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/.gemini/system.md +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/.github/workflows/create_pr_to_main.yml +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/.github/workflows/lint.yml +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/.github/workflows/release.yml +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/.github/workflows/remove_branch.yml +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/.gitignore +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/.gitpod.yml +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/GEMINI.md +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/README.md +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/__init__.py +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/__init__.py +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/cargo/__init__.py +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/cargo/benchmark.py +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/cargo/profiling.py +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/cargo/utils.py +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/container/__init__.py +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/container/build_container_images.py +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/container/config_container.py +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/github/__init__.py +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/github/add_github_repo.py +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/github/create_pull_request.py +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/github/release_on_github.py +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/github/remove_branch.py +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/github/workflows/create_pr_dev_to_main.yml +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/github/workflows/create_pr_to_dev.yml +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/github/workflows/create_pr_to_main.yml +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/github/workflows/python/lint.yml +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/github/workflows/python/test.yml +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/github/workflows/remove_branch.yml +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/utils.py +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/github.py +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/utils.py +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/memory/MEMORY.md +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/memory/feedback_test_runner.md +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/tests/__init__.py +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/tests/test_build_container_images.py +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/tests/test_utils.py +0 -0
- {github_rest_api-0.35.0 → github_rest_api-0.36.0}/uv.lock +0 -0
|
@@ -28,83 +28,15 @@ def parse_latest_version(repo: str) -> str:
|
|
|
28
28
|
def update_version(
|
|
29
29
|
containerfile: str | Path, version: str, pattern: str, replace: str
|
|
30
30
|
) -> None:
|
|
31
|
-
if
|
|
32
|
-
|
|
31
|
+
if not pattern:
|
|
32
|
+
raise ValueError("The pattern to replace must not be empty.")
|
|
33
33
|
if isinstance(containerfile, str):
|
|
34
|
-
containerfile = Path(containerfile)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
case "docker-jupyterlab":
|
|
41
|
-
return _update_version_docker_jupyterlab(
|
|
42
|
-
containerfile=containerfile, version=version
|
|
43
|
-
)
|
|
44
|
-
case "docker-jupyterhub":
|
|
45
|
-
return _update_version_docker_jupyterhub(
|
|
46
|
-
containerfile=containerfile, version=version
|
|
47
|
-
)
|
|
48
|
-
case "docker-vscode-server":
|
|
49
|
-
return _update_version_docker_vscode_server(
|
|
50
|
-
containerfile=containerfile, version=version
|
|
51
|
-
)
|
|
52
|
-
case _:
|
|
53
|
-
if not pattern:
|
|
54
|
-
raise ValueError("A version pattern must be specified!")
|
|
55
|
-
return _update_version_default(
|
|
56
|
-
containerfile=containerfile,
|
|
57
|
-
version=version,
|
|
58
|
-
pattern=pattern,
|
|
59
|
-
replace=replace,
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
def _update_version_default(
|
|
64
|
-
containerfile: Path, version: str, pattern: str, replace: str
|
|
65
|
-
) -> None:
|
|
66
|
-
text = containerfile.read_text()
|
|
67
|
-
text = re.sub(pattern, replace.format(version=version), text)
|
|
68
|
-
containerfile.write_text(text)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
def _update_version_docker_base(containerfile: Path, version: str) -> None:
|
|
72
|
-
_update_version_default(
|
|
73
|
-
containerfile=containerfile,
|
|
74
|
-
version=version,
|
|
75
|
-
pattern=r"-v v?\d+\.\d+\.\d+",
|
|
76
|
-
replace="-v v{version}",
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
def _update_version_docker_jupyterlab(containerfile: Path, version: str) -> None:
|
|
81
|
-
version = next_minor_or_strip_patch(version, 3)
|
|
82
|
-
_update_version_default(
|
|
83
|
-
containerfile=containerfile,
|
|
84
|
-
version=version,
|
|
85
|
-
pattern=r",<\d+\.\d+\.0",
|
|
86
|
-
replace=",<{version}",
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
def _update_version_docker_jupyterhub(containerfile: Path, version: str) -> None:
|
|
91
|
-
version = next_minor_or_strip_patch(version, 3)
|
|
92
|
-
_update_version_default(
|
|
93
|
-
containerfile=containerfile,
|
|
94
|
-
version=version,
|
|
95
|
-
pattern=r"jupyterhub<\d+\.\d+\.0",
|
|
96
|
-
replace="jupyterhub<{version}",
|
|
97
|
-
)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
def _update_version_docker_vscode_server(containerfile: Path, version: str) -> None:
|
|
101
|
-
version = next_minor_or_strip_patch(version, 3)
|
|
102
|
-
_update_version_default(
|
|
103
|
-
containerfile=containerfile,
|
|
104
|
-
version=version,
|
|
105
|
-
pattern=r",<\d+\.\d+\.0",
|
|
106
|
-
replace=",<{version}",
|
|
107
|
-
)
|
|
34
|
+
containerfile = Path(containerfile)
|
|
35
|
+
original = containerfile.read_text(encoding="utf-8")
|
|
36
|
+
repl = replace.replace("{version}", version)
|
|
37
|
+
updated = re.sub(pattern, lambda _: repl, original)
|
|
38
|
+
if updated != original:
|
|
39
|
+
containerfile.write_text(updated, encoding="utf-8")
|
|
108
40
|
|
|
109
41
|
|
|
110
42
|
def _branch_prefix(repo: str) -> str:
|
|
@@ -134,7 +66,7 @@ def parse_args():
|
|
|
134
66
|
parser.add_argument(
|
|
135
67
|
"--containerfile",
|
|
136
68
|
dest="containerfile",
|
|
137
|
-
|
|
69
|
+
required=True,
|
|
138
70
|
help="The Dockerfile or Containerfile to update.",
|
|
139
71
|
)
|
|
140
72
|
parser.add_argument(
|
|
@@ -152,15 +84,25 @@ def parse_args():
|
|
|
152
84
|
parser.add_argument(
|
|
153
85
|
"--pattern",
|
|
154
86
|
dest="pattern",
|
|
155
|
-
|
|
87
|
+
required=True,
|
|
156
88
|
help="The version pattern to replace.",
|
|
157
89
|
)
|
|
158
90
|
parser.add_argument(
|
|
159
91
|
"--replace",
|
|
160
92
|
dest="replace",
|
|
161
|
-
|
|
93
|
+
required=True,
|
|
162
94
|
help="The replacement for the matched version pattern.",
|
|
163
95
|
)
|
|
96
|
+
parser.add_argument(
|
|
97
|
+
"--next-minor-or-strip-patch",
|
|
98
|
+
dest="next_minor_or_strip_patch",
|
|
99
|
+
type=int,
|
|
100
|
+
default=None,
|
|
101
|
+
help=(
|
|
102
|
+
"If provided, transform the version with next_minor_or_strip_patch(version, N): "
|
|
103
|
+
"bump to next minor if patch >= N, otherwise strip patch to 0."
|
|
104
|
+
),
|
|
105
|
+
)
|
|
164
106
|
return parser.parse_args()
|
|
165
107
|
|
|
166
108
|
|
|
@@ -188,6 +130,8 @@ def main():
|
|
|
188
130
|
return
|
|
189
131
|
checkout_branch(args.repo)
|
|
190
132
|
version = parse_latest_version(repo=args.repo)
|
|
133
|
+
if args.next_minor_or_strip_patch is not None:
|
|
134
|
+
version = next_minor_or_strip_patch(version, args.next_minor_or_strip_patch)
|
|
191
135
|
update_version(
|
|
192
136
|
containerfile=args.containerfile,
|
|
193
137
|
version=version,
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
+
import os
|
|
1
2
|
from github_rest_api.github import User, Organization, Repository
|
|
2
3
|
|
|
4
|
+
TOKEN = os.environ.get("GITHUB_TOKEN", "")
|
|
5
|
+
|
|
3
6
|
|
|
4
7
|
def test_user_get_repositories():
|
|
5
|
-
|
|
6
|
-
username = "dclong"
|
|
7
|
-
user = User(token, username)
|
|
8
|
+
user = User(TOKEN, "dclong")
|
|
8
9
|
repos = user.get_repositories()
|
|
9
10
|
assert len(repos) > 0
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
def test_organization_get_repositories():
|
|
13
|
-
|
|
14
|
-
org_name = "legendu-net"
|
|
15
|
-
org = Organization(token, org_name)
|
|
14
|
+
org = Organization(TOKEN, "legendu-net")
|
|
16
15
|
repos = org.get_repositories()
|
|
17
16
|
assert len(repos) > 0
|
|
18
17
|
|
|
19
18
|
|
|
20
19
|
def test_repository_get_branch():
|
|
21
|
-
|
|
22
|
-
repo_name = "legendu-net/github_rest_api"
|
|
23
|
-
repo = Repository(token, repo_name)
|
|
20
|
+
repo = Repository(TOKEN, "legendu-net/github_rest_api")
|
|
24
21
|
branch = repo.get_branch("main")
|
|
25
22
|
assert branch["name"] == "main"
|
|
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.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/cargo/benchmark.py
RENAMED
|
File without changes
|
{github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/cargo/profiling.py
RENAMED
|
File without changes
|
|
File without changes
|
{github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/container/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/github/__init__.py
RENAMED
|
File without changes
|
{github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/github/add_github_repo.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{github_rest_api-0.35.0 → github_rest_api-0.36.0}/github_rest_api/actions/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
|