github-rest-api 0.47.1__tar.gz → 0.47.2__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.
Files changed (51) hide show
  1. github_rest_api-0.47.2/.github/workflows/auto_merge_pull_request.yaml +30 -0
  2. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/.github/workflows/claude-code-review.yml +14 -2
  3. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/PKG-INFO +1 -1
  4. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/scripts/github/create_github_repo.py +28 -2
  5. github_rest_api-0.47.2/github_rest_api/scripts/github/workflows/auto_merge_pull_request.yaml +30 -0
  6. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/pyproject.toml +1 -1
  7. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/uv.lock +1 -1
  8. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/.devcontainer/devcontainer.json +0 -0
  9. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/.github/workflows/claude.yml +0 -0
  10. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/.github/workflows/create_pr_to_main.yaml +0 -0
  11. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/.github/workflows/lint.yaml +0 -0
  12. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/.github/workflows/release.yaml +0 -0
  13. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/.github/workflows/remove_branch.yaml +0 -0
  14. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/.github/workflows/test.yaml +0 -0
  15. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/.gitignore +0 -0
  16. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/GEMINI.md +0 -0
  17. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/README.md +0 -0
  18. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/__init__.py +0 -0
  19. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/github.py +0 -0
  20. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/pr_content.py +0 -0
  21. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/scripts/__init__.py +0 -0
  22. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/scripts/cargo/__init__.py +0 -0
  23. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/scripts/cargo/benchmark.py +0 -0
  24. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/scripts/cargo/profiling.py +0 -0
  25. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/scripts/cargo/utils.py +0 -0
  26. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/scripts/container/__init__.py +0 -0
  27. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/scripts/container/build_container_images.py +0 -0
  28. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/scripts/container/config_container.py +0 -0
  29. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/scripts/container/update_version_containerfile.py +0 -0
  30. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/scripts/github/__init__.py +0 -0
  31. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/scripts/github/auto_merge_pull_request.py +0 -0
  32. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/scripts/github/create_pull_request.py +0 -0
  33. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/scripts/github/release_on_github.py +0 -0
  34. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/scripts/github/remove_branch.py +0 -0
  35. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/scripts/github/workflows/create_pr_dev_to_main.yaml +0 -0
  36. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/scripts/github/workflows/create_pr_to_dev.yaml +0 -0
  37. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/scripts/github/workflows/create_pr_to_main.yaml +0 -0
  38. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/scripts/github/workflows/python/lint.yaml +0 -0
  39. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/scripts/github/workflows/python/test.yaml +0 -0
  40. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/scripts/github/workflows/remove_branch.yaml +0 -0
  41. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/scripts/utils.py +0 -0
  42. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/github_rest_api/utils.py +0 -0
  43. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/memory/MEMORY.md +0 -0
  44. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/memory/feedback_test_runner.md +0 -0
  45. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/tests/__init__.py +0 -0
  46. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/tests/test_build_container_images.py +0 -0
  47. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/tests/test_create_pull_request.py +0 -0
  48. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/tests/test_github.py +0 -0
  49. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/tests/test_pr_content.py +0 -0
  50. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/tests/test_release_on_github.py +0 -0
  51. {github_rest_api-0.47.1 → github_rest_api-0.47.2}/tests/test_utils.py +0 -0
@@ -0,0 +1,30 @@
1
+ name: Auto Merge PR
2
+ on:
3
+ pull_request_review:
4
+ types:
5
+ - submitted
6
+ issue_comment:
7
+ types:
8
+ - created
9
+ check_suite:
10
+ types:
11
+ - completed
12
+ schedule:
13
+ - cron: '0 * * * *'
14
+ timezone: 'America/Los_Angeles'
15
+ permissions:
16
+ contents: write
17
+ pull-requests: write
18
+ jobs:
19
+ auto_merge_pull_request:
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - name: Install uv
23
+ run: |
24
+ curl -LsSf https://astral.sh/uv/install.sh | sudo env UV_INSTALL_DIR="/usr/local/bin" sh
25
+ - name: Auto Merge PR
26
+ run: |
27
+ uvx --from github-rest-api@latest auto_merge_pull_request \
28
+ --authors dclong \
29
+ --approvers dclong 'claude[bot]' 'gemini-code-assist[bot]' \
30
+ --token ${{ secrets.ACTIONS_TOKEN }}
@@ -38,7 +38,19 @@ jobs:
38
38
  claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
39
39
  plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
40
40
  plugins: 'code-review@claude-code-plugins'
41
- prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
41
+ prompt: |
42
+ Review the pull request ${{ github.repository }}/pull/${{ github.event.pull_request.number }}
43
+ with the /code-review:code-review command.
44
+
45
+ When the review is finished, decide whether this PR is safe to merge
46
+ automatically: it is safe only if the review surfaced no correctness bugs
47
+ and no other blocking issues (non-blocking style or cleanup suggestions do
48
+ not disqualify it). If and only if it is safe, post a single new comment on
49
+ the pull request whose body includes, on its own line, this exact marker
50
+ (a short note such as "Approved for auto-merge." above it is fine):
51
+ <!-- auto-merge: approved -->
52
+ If you found any blocking issue, do NOT post the marker. Always post a fresh
53
+ comment rather than editing an existing one, so the marker's timestamp
54
+ follows the latest commit.
42
55
  # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
43
56
  # or https://code.claude.com/docs/en/cli-reference for available options
44
-
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: github-rest-api
3
- Version: 0.47.1
3
+ Version: 0.47.2
4
4
  Summary: Simple wrapper of GitHub REST APIs.
5
5
  Author-email: Ben Du <longendu@yahoo.com>
6
6
  Classifier: Programming Language :: Python :: 3 :: Only
@@ -2,6 +2,7 @@
2
2
 
3
3
  import argparse
4
4
  import getpass
5
+ import logging
5
6
  import os
6
7
  import shutil
7
8
  import sys
@@ -12,6 +13,8 @@ from dulwich import porcelain
12
13
 
13
14
  from github_rest_api import Organization, User
14
15
 
16
+ logger = logging.getLogger(__name__)
17
+
15
18
 
16
19
  def _validate_repo(repo: str) -> None:
17
20
  parts = repo.split("/")
@@ -28,8 +31,9 @@ def _create_remote_repo(
28
31
  if is_owner_user
29
32
  else Organization(token=token, org=owner)
30
33
  )
34
+ logger.info("Creating remote GitHub repository '%s'...", repo)
31
35
  entity.create_repository(name=r, private=private)
32
- print(f"\nCreated the GitHub repo https://github.com/{repo}.\n")
36
+ logger.info("Created the GitHub repo https://github.com/%s.", repo)
33
37
 
34
38
 
35
39
  def _remote_url(repo: str, protocol: str) -> str:
@@ -41,6 +45,7 @@ def _remote_url(repo: str, protocol: str) -> str:
41
45
  def _ensure_remote(path: Path, repo: str, protocol: str) -> None:
42
46
  try:
43
47
  porcelain.remote_add(path, "origin", _remote_url(repo, protocol))
48
+ logger.info("Added remote 'origin' for %s", repo)
44
49
  except porcelain.RemoteExists:
45
50
  pass
46
51
 
@@ -70,24 +75,32 @@ def _init_local_repo(
70
75
  readme = path / "README.md"
71
76
  if not readme.exists():
72
77
  readme.write_text(f"# {repo_name}\n")
78
+ logger.info("Created %s", readme)
73
79
  if not (path / ".git").exists():
74
80
  porcelain.init(path=path)
81
+ logger.info("Initialized empty Git repository in %s", path)
75
82
  if not porcelain.branch_list(path):
76
83
  initial_branch = _active_branch(path)
77
84
  porcelain.add(repo=path, paths=["README.md"])
85
+ logger.info("Added README.md to staging")
78
86
  porcelain.commit(repo=path, message="first commit")
87
+ logger.info("Created first commit")
79
88
  for branch in branches:
80
89
  if branch != initial_branch:
81
90
  porcelain.branch_create(repo=path, name=branch)
91
+ logger.info("Created branch '%s'", branch)
82
92
  porcelain.checkout(repo=path, target=branches[0])
93
+ logger.info("Checked out branch '%s'", branches[0])
83
94
  if initial_branch not in branches:
84
95
  porcelain.branch_delete(repo=path, name=initial_branch)
96
+ logger.info("Deleted initial branch '%s'", initial_branch)
85
97
  _ensure_remote(path, repo, protocol)
86
98
  local_branches = {b.decode() for b in porcelain.branch_list(path)}
87
99
  branches_to_push = [branch for branch in branches if branch in local_branches]
88
100
  if not branches_to_push:
89
101
  branches_to_push = [_active_branch(path)]
90
102
  for branch in branches_to_push:
103
+ logger.info("Pushing branch '%s' to remote '%s'...", branch, repo)
91
104
  porcelain.push(
92
105
  repo=path,
93
106
  remote_location=_remote_url(repo, "https"),
@@ -95,6 +108,7 @@ def _init_local_repo(
95
108
  username="x-access-token",
96
109
  password=token,
97
110
  )
111
+ logger.info("Successfully pushed branch '%s'.", branch)
98
112
  _add_workflow(path, language)
99
113
 
100
114
 
@@ -138,6 +152,7 @@ def _add_workflow(path: Path, language: str, workflow_dir: Path | None = None) -
138
152
  for yaml in workflow_dir.glob("*.yaml"):
139
153
  if not (dir_dest / yaml.name).exists():
140
154
  shutil.copy2(yaml, dir_dest)
155
+ logger.info("Copied workflow %s to %s", yaml.name, dir_dest)
141
156
  if not language:
142
157
  return
143
158
  lang_dir = workflow_dir / language
@@ -146,6 +161,9 @@ def _add_workflow(path: Path, language: str, workflow_dir: Path | None = None) -
146
161
  for yaml in lang_dir.glob("*.yaml"):
147
162
  if not (dir_dest / yaml.name).exists():
148
163
  shutil.copy2(yaml, dir_dest)
164
+ logger.info(
165
+ "Copied %s specific workflow %s to %s", language, yaml.name, dir_dest
166
+ )
149
167
 
150
168
 
151
169
  def parse_args(args=None, namespace=None):
@@ -215,11 +233,19 @@ def parse_args(args=None, namespace=None):
215
233
  default="git",
216
234
  help="Use the HTTPS protocol for the remote URL.",
217
235
  )
236
+ parser.add_argument(
237
+ "-v",
238
+ "--verbose",
239
+ dest="verbose",
240
+ action="store_true",
241
+ help="Enable verbose output, including tracebacks on errors.",
242
+ )
218
243
  return parser.parse_args(args=args, namespace=namespace)
219
244
 
220
245
 
221
246
  def main() -> int:
222
247
  args = parse_args()
248
+ logging.basicConfig(level=logging.INFO, format="%(message)s")
223
249
  try:
224
250
  create_github_repo(
225
251
  repo=args.repo,
@@ -232,7 +258,7 @@ def main() -> int:
232
258
  protocol=args.protocol,
233
259
  )
234
260
  except Exception as e:
235
- print(str(e), file=sys.stderr)
261
+ logger.error("Failed to create GitHub repo: %s", e, exc_info=args.verbose)
236
262
  return 1
237
263
  return 0
238
264
 
@@ -0,0 +1,30 @@
1
+ name: Auto Merge PR
2
+ on:
3
+ pull_request_review:
4
+ types:
5
+ - submitted
6
+ issue_comment:
7
+ types:
8
+ - created
9
+ check_suite:
10
+ types:
11
+ - completed
12
+ schedule:
13
+ - cron: '0 * * * *'
14
+ timezone: 'America/Los_Angeles'
15
+ permissions:
16
+ contents: write
17
+ pull-requests: write
18
+ jobs:
19
+ auto_merge_pull_request:
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - name: Install uv
23
+ run: |
24
+ curl -LsSf https://astral.sh/uv/install.sh | sudo env UV_INSTALL_DIR="/usr/local/bin" sh
25
+ - name: Auto Merge PR
26
+ run: |
27
+ uvx --from github-rest-api@latest auto_merge_pull_request \
28
+ --authors dclong \
29
+ --approvers dclong 'claude[bot]' 'gemini-code-assist[bot]' \
30
+ --token ${{ secrets.ACTIONS_TOKEN }}
@@ -4,7 +4,7 @@ requires = [ "hatchling" ]
4
4
 
5
5
  [project]
6
6
  name = "github-rest-api"
7
- version = "0.47.1"
7
+ version = "0.47.2"
8
8
  description = "Simple wrapper of GitHub REST APIs."
9
9
  readme = "README.md"
10
10
  authors = [ { name = "Ben Du", email = "longendu@yahoo.com" } ]
@@ -542,7 +542,7 @@ wheels = [
542
542
 
543
543
  [[package]]
544
544
  name = "github-rest-api"
545
- version = "0.47.1"
545
+ version = "0.47.2"
546
546
  source = { editable = "." }
547
547
  dependencies = [
548
548
  { name = "dulwich" },