github-rest-api 0.46.0__py3-none-any.whl → 0.47.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.
- github_rest_api/scripts/github/create_github_repo.py +21 -13
- {github_rest_api-0.46.0.dist-info → github_rest_api-0.47.0.dist-info}/METADATA +1 -1
- {github_rest_api-0.46.0.dist-info → github_rest_api-0.47.0.dist-info}/RECORD +5 -5
- {github_rest_api-0.46.0.dist-info → github_rest_api-0.47.0.dist-info}/WHEEL +0 -0
- {github_rest_api-0.46.0.dist-info → github_rest_api-0.47.0.dist-info}/entry_points.txt +0 -0
|
@@ -38,6 +38,13 @@ def _remote_url(repo: str, protocol: str) -> str:
|
|
|
38
38
|
return f"https://github.com/{repo}.git"
|
|
39
39
|
|
|
40
40
|
|
|
41
|
+
def _ensure_remote(path: Path, repo: str, protocol: str) -> None:
|
|
42
|
+
try:
|
|
43
|
+
porcelain.remote_add(path, "origin", _remote_url(repo, protocol))
|
|
44
|
+
except porcelain.RemoteExists:
|
|
45
|
+
pass
|
|
46
|
+
|
|
47
|
+
|
|
41
48
|
def _init_local_repo(
|
|
42
49
|
repo: str,
|
|
43
50
|
language: str,
|
|
@@ -54,29 +61,30 @@ def _init_local_repo(
|
|
|
54
61
|
readme.write_text(f"# {repo_name}\n")
|
|
55
62
|
if not (path / ".git").exists():
|
|
56
63
|
porcelain.init(path=path)
|
|
57
|
-
porcelain.remote_add(path, "origin", _remote_url(repo, protocol))
|
|
58
64
|
initial_branch = (
|
|
59
65
|
(path / ".git" / "HEAD").read_text().strip().partition("refs/heads/")[-1]
|
|
60
66
|
)
|
|
61
67
|
porcelain.add(repo=path)
|
|
62
68
|
porcelain.commit(repo=path, message="first commit")
|
|
63
|
-
|
|
64
|
-
def _create_push_branch(branch: str):
|
|
69
|
+
for branch in branches:
|
|
65
70
|
if branch != initial_branch:
|
|
66
71
|
porcelain.branch_create(repo=path, name=branch)
|
|
67
|
-
porcelain.checkout(repo=path, target=branch)
|
|
68
|
-
porcelain.push(
|
|
69
|
-
repo=path,
|
|
70
|
-
remote_location=_remote_url(repo, "https"),
|
|
71
|
-
username="x-access-token",
|
|
72
|
-
password=token,
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
for branch in branches:
|
|
76
|
-
_create_push_branch(branch)
|
|
77
72
|
porcelain.checkout(repo=path, target=branches[0])
|
|
78
73
|
if initial_branch not in branches:
|
|
79
74
|
porcelain.branch_delete(repo=path, name=initial_branch)
|
|
75
|
+
_ensure_remote(path, repo, protocol)
|
|
76
|
+
local_branches = {b.decode() for b in porcelain.branch_list(path)}
|
|
77
|
+
branches_to_push = [branch for branch in branches if branch in local_branches]
|
|
78
|
+
if not branches_to_push:
|
|
79
|
+
branches_to_push = [porcelain.active_branch(path).decode()]
|
|
80
|
+
for branch in branches_to_push:
|
|
81
|
+
porcelain.push(
|
|
82
|
+
repo=path,
|
|
83
|
+
remote_location=_remote_url(repo, "https"),
|
|
84
|
+
refspecs=[branch.encode()],
|
|
85
|
+
username="x-access-token",
|
|
86
|
+
password=token,
|
|
87
|
+
)
|
|
80
88
|
_add_workflow(path, language)
|
|
81
89
|
|
|
82
90
|
|
|
@@ -14,7 +14,7 @@ github_rest_api/scripts/container/config_container.py,sha256=BtOqgZlQFM9cWZMoHKv
|
|
|
14
14
|
github_rest_api/scripts/container/update_version_containerfile.py,sha256=1PkuJkAsJBCEMdacMSndbuZKcmgUyXy6nBArnxKoPZk,4535
|
|
15
15
|
github_rest_api/scripts/github/__init__.py,sha256=tEU1SdCS51M4M13WoqXZt3rjGEAI_QgNljt5XAyQJ_w,38
|
|
16
16
|
github_rest_api/scripts/github/auto_merge_pull_request.py,sha256=_5191Xt_b8DtxjIqHrdY-gKLxvkzWd8oWoSbF2uauc8,3527
|
|
17
|
-
github_rest_api/scripts/github/create_github_repo.py,sha256=
|
|
17
|
+
github_rest_api/scripts/github/create_github_repo.py,sha256=7t2dgDcLrLPpBY5CpTtkkIe8Z_-2FGgoRo_--HXwcuw,6686
|
|
18
18
|
github_rest_api/scripts/github/create_pull_request.py,sha256=gXtRRsxzegGxagHb6k3kxtRd3mt4QVwSPZQpsFnzz1Y,3968
|
|
19
19
|
github_rest_api/scripts/github/release_on_github.py,sha256=9psaIv-GtrHdvE-tkw0yxCMDmW0bPts-db2vUxhoKXo,4368
|
|
20
20
|
github_rest_api/scripts/github/remove_branch.py,sha256=iKZ4Y_lQlSOIfifC4plqP-B6pEMnFrknGMvV1oLnuLc,3538
|
|
@@ -24,7 +24,7 @@ github_rest_api/scripts/github/workflows/create_pr_to_main.yaml,sha256=mgHPlewkC
|
|
|
24
24
|
github_rest_api/scripts/github/workflows/remove_branch.yaml,sha256=KDpB76ovrhuRdP0HN5j6Th9gjIQWSDdh8b4b4yAgtoI,544
|
|
25
25
|
github_rest_api/scripts/github/workflows/python/lint.yaml,sha256=toP2oUdVIKyu_n20Dr14k5cJYxN8rPksfbX4sfflXxc,699
|
|
26
26
|
github_rest_api/scripts/github/workflows/python/test.yaml,sha256=86MljYEWX1E9kJYmhMCLwu46WNEWvoyO9PwqeRew540,887
|
|
27
|
-
github_rest_api-0.
|
|
28
|
-
github_rest_api-0.
|
|
29
|
-
github_rest_api-0.
|
|
30
|
-
github_rest_api-0.
|
|
27
|
+
github_rest_api-0.47.0.dist-info/METADATA,sha256=SjlTYqUbYuVm5n3gvDE7NE1PutETNTXXoV609PLMOsc,915
|
|
28
|
+
github_rest_api-0.47.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
29
|
+
github_rest_api-0.47.0.dist-info/entry_points.txt,sha256=OfbP9GuQC7SyGbymfCYrXEG-TCcKuu31v0EPNvHc1Q4,659
|
|
30
|
+
github_rest_api-0.47.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|