github-overlord 0.3.3__tar.gz → 0.4.1__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_overlord-0.3.3 → github_overlord-0.4.1}/PKG-INFO +2 -1
- {github_overlord-0.3.3 → github_overlord-0.4.1}/github_overlord/__init__.py +43 -1
- {github_overlord-0.3.3 → github_overlord-0.4.1}/pyproject.toml +2 -1
- {github_overlord-0.3.3 → github_overlord-0.4.1}/README.md +0 -0
- {github_overlord-0.3.3 → github_overlord-0.4.1}/github_overlord/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: github-overlord
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: Automatically merge Dependabot PRs in public repositories
|
|
5
5
|
Home-page: https://github.com/iloveitaly/github-overlord
|
|
6
6
|
Keywords: github,dependabot,automation
|
|
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
13
13
|
Requires-Dist: apscheduler (>=3.10.4,<4.0.0)
|
|
14
14
|
Requires-Dist: click (>=8.1.7,<9.0.0)
|
|
15
15
|
Requires-Dist: funcy-pipe (>=0.11.0,<0.12.0)
|
|
16
|
+
Requires-Dist: openai (>=1.33.0,<2.0.0)
|
|
16
17
|
Requires-Dist: pygithub (>=2.3.0,<3.0.0)
|
|
17
18
|
Requires-Dist: python-decouple-typed (>=3.11.0,<4.0.0)
|
|
18
19
|
Requires-Dist: structlog (>=24.2.0,<25.0.0)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import re
|
|
3
3
|
import time
|
|
4
|
+
from types import NoneType
|
|
4
5
|
|
|
5
6
|
import click
|
|
6
7
|
import funcy_pipe as fp
|
|
@@ -42,11 +43,35 @@ def resolve_async_status(object, key):
|
|
|
42
43
|
return
|
|
43
44
|
|
|
44
45
|
|
|
46
|
+
def handle_stale_dependabot_pr(pr: PullRequest) -> None:
|
|
47
|
+
"""
|
|
48
|
+
Handle a dependabot PR that has been open for at least 30 days and has conflicts
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
assert not pr.mergeable
|
|
52
|
+
assert pr.mergeable_state == "dirty"
|
|
53
|
+
|
|
54
|
+
if pr.body is None:
|
|
55
|
+
return
|
|
56
|
+
|
|
57
|
+
if "Automatic rebases have been disabled on this pull request" in pr.body:
|
|
58
|
+
log.info(
|
|
59
|
+
"PR has disabled automatic rebases, manually commenting", url=pr.html_url
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
pr.create_issue_comment("@dependabot rebase")
|
|
63
|
+
|
|
64
|
+
|
|
45
65
|
def is_eligible_for_merge(pr: PullRequest):
|
|
46
66
|
resolve_async_status(pr, "mergeable")
|
|
47
67
|
|
|
68
|
+
if pr.state == "closed":
|
|
69
|
+
log.debug("PR is closed", url=pr.html_url)
|
|
70
|
+
return
|
|
71
|
+
|
|
48
72
|
if not pr.mergeable:
|
|
49
73
|
log.debug("PR is not mergeable", url=pr.html_url)
|
|
74
|
+
handle_stale_dependabot_pr(pr)
|
|
50
75
|
return False
|
|
51
76
|
|
|
52
77
|
if pr.user.login != "dependabot[bot]":
|
|
@@ -86,7 +111,7 @@ def process_repo(repo, dry_run):
|
|
|
86
111
|
|
|
87
112
|
pulls = repo.get_pulls(state="open")
|
|
88
113
|
|
|
89
|
-
if pulls.totalCount == 0:
|
|
114
|
+
if pulls.totalCount == 0 or pulls == NoneType:
|
|
90
115
|
log.debug("no open prs, skipping")
|
|
91
116
|
return
|
|
92
117
|
|
|
@@ -166,6 +191,23 @@ def pr_bumper():
|
|
|
166
191
|
pass
|
|
167
192
|
|
|
168
193
|
|
|
194
|
+
"""
|
|
195
|
+
token = token or os.getenv('GITHUB_TOKEN')
|
|
196
|
+
if not token:
|
|
197
|
+
raise ValueError("GitHub token must be provided either as an option or via the GITHUB_TOKEN environment variable")
|
|
198
|
+
|
|
199
|
+
g = Github(token)
|
|
200
|
+
user = g.get_user()
|
|
201
|
+
notifications = user.get_notifications()
|
|
202
|
+
|
|
203
|
+
for notification in notifications:
|
|
204
|
+
print(f"Notification: {notification.subject['title']}, Reason: {notification.reason}")
|
|
205
|
+
if not read_only:
|
|
206
|
+
notification.mark_as_read()
|
|
207
|
+
|
|
208
|
+
"""
|
|
209
|
+
|
|
210
|
+
|
|
169
211
|
cli.add_command(dependabot)
|
|
170
212
|
|
|
171
213
|
if __name__ == "__main__":
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "github-overlord"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.4.1"
|
|
4
4
|
description = "Automatically merge Dependabot PRs in public repositories"
|
|
5
5
|
authors = ["Michael Bianco <mike@mikebian.co>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -15,6 +15,7 @@ python-decouple-typed = "^3.11.0"
|
|
|
15
15
|
funcy-pipe = "^0.11.0"
|
|
16
16
|
structlog = "^24.2.0"
|
|
17
17
|
apscheduler = "^3.10.4"
|
|
18
|
+
openai = "^1.33.0"
|
|
18
19
|
|
|
19
20
|
[tool.poetry.scripts]
|
|
20
21
|
github-overlord = "github_overlord:cli"
|
|
File without changes
|
|
File without changes
|