github-overlord 0.6.6__tar.gz → 0.6.8__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: github-overlord
3
- Version: 0.6.6
3
+ Version: 0.6.8
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
@@ -17,7 +17,7 @@ from github_overlord.stale_commenter import (
17
17
  )
18
18
  from github_overlord.utils import log
19
19
 
20
- AUTOMATIC_MERGE_MESSAGE = "Automatically merged with GitHub overlord"
20
+ AUTOMATIC_MERGE_MESSAGE = "Automatically merged with [github-overlord](https://github.com/iloveitaly/github-overlord)"
21
21
 
22
22
 
23
23
  def merge_pr(pr, dry_run):
@@ -137,7 +137,7 @@ def process_repo(repo, dry_run):
137
137
  log.info("merged prs", count=merged_pr_count)
138
138
 
139
139
 
140
- def main(token, dry_run, repo):
140
+ def merge_dependabot_prs(token, dry_run, repo):
141
141
  assert token, "GitHub token is required"
142
142
 
143
143
  g = Github(token)
@@ -157,6 +157,11 @@ def main(token, dry_run, repo):
157
157
 
158
158
  @click.group()
159
159
  def cli():
160
+ """
161
+ GitHub Overlord is a tool to help manage annoying tasks across your GitHub repositories. Some of this could be done
162
+ by GitHub Actions, but this eliminates the need to carefully configure GH actions for each repo.
163
+ """
164
+
160
165
  pass
161
166
 
162
167
 
@@ -192,9 +197,11 @@ def dependabot(token, dry_run, repo):
192
197
  Automatically merge dependabot PRs in public repos that have passed CI checks
193
198
  """
194
199
 
200
+ log.info("merging dependabot PRs")
201
+
195
202
  repo = extract_repo_reference_from_github_url(repo)
196
203
 
197
- main(token, dry_run, repo)
204
+ merge_dependabot_prs(token, dry_run, repo)
198
205
 
199
206
 
200
207
  @click.command()
@@ -207,9 +214,15 @@ def dependabot(token, dry_run, repo):
207
214
  @click.option("--dry-run", is_flag=True, help="Run script without merging PRs")
208
215
  @click.option("--repo", help="Only process a single repository")
209
216
  def keep_alive_prs(token, dry_run, repo):
217
+ """
218
+ Detect when a bot is about to close a PR for no good reason and make a comment to keep it alive
219
+ """
220
+
210
221
  assert token, "GitHub token is required"
211
222
  # TODO should assert on openai setup
212
223
 
224
+ log.info("checking for stale PRs")
225
+
213
226
  github = Github(token)
214
227
  user = github.get_user()
215
228
  login = user.login
@@ -220,8 +233,11 @@ def keep_alive_prs(token, dry_run, repo):
220
233
  inspect_repo_for_stale_prs(dry_run, login, github.get_repo(repo))
221
234
  return
222
235
 
236
+ def transform_forked_repos(repo):
237
+ return repo.parent if repo.fork else repo
238
+
223
239
  # TODO this isn't perfect because you may be a contributor :/
224
- user.get_repos(type="public") | fp.filter(
240
+ user.get_repos(type="public") | fp.map(transform_forked_repos) | fp.filter(
225
241
  lambda repo: repo.owner.login != login
226
242
  ) | fp.map(fp.partial(inspect_repo_for_stale_prs, dry_run, login)) | fp.to_list()
227
243
 
@@ -14,7 +14,9 @@ def inspect_repo_for_stale_prs(dry_run: bool, login: str, repo: Repository):
14
14
  log.debug("inspecting repo for stale PRs", repo=repo.full_name)
15
15
 
16
16
  return (
17
+ # there is not a way to filter by the user which created the PR! This take a long time on repos with many PRs
17
18
  repo.get_pulls(state="open")
19
+ # make sure the auth token user is the author of the PR
18
20
  | fp.filter(lambda pr: pr.user.login == login)
19
21
  | fp.map(fp.partial(check_for_stale_comments, dry_run))
20
22
  | fp.to_list()
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "github-overlord"
3
- version = "0.6.6"
3
+ version = "0.6.8"
4
4
  description = "Automatically merge Dependabot PRs in public repositories"
5
5
  authors = ["Michael Bianco <mike@mikebian.co>"]
6
6
  readme = "README.md"