github-overlord 0.3.2__tar.gz → 0.3.3__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.3.2
3
+ Version: 0.3.3
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
@@ -47,3 +47,7 @@ Options:
47
47
  ```
48
48
 
49
49
  ### Docker Cron
50
+
51
+ There's a docker container you can use to run this on a cron. [Fits nicely into a orange pi.](https://mikebian.co/pi-hole-tailscale-and-docker-on-an-orange-pi/)
52
+
53
+ Check out [docker-compose.yml](./docker-compose.yml) for an example, or `git pull ghcr.io/iloveitaly/github-overlord:latest`.
@@ -26,4 +26,8 @@ Options:
26
26
  --help Show this message and exit.
27
27
  ```
28
28
 
29
- ### Docker Cron
29
+ ### Docker Cron
30
+
31
+ There's a docker container you can use to run this on a cron. [Fits nicely into a orange pi.](https://mikebian.co/pi-hole-tailscale-and-docker-on-an-orange-pi/)
32
+
33
+ Check out [docker-compose.yml](./docker-compose.yml) for an example, or `git pull ghcr.io/iloveitaly/github-overlord:latest`.
@@ -46,9 +46,11 @@ def is_eligible_for_merge(pr: PullRequest):
46
46
  resolve_async_status(pr, "mergeable")
47
47
 
48
48
  if not pr.mergeable:
49
+ log.debug("PR is not mergeable", url=pr.html_url)
49
50
  return False
50
51
 
51
52
  if pr.user.login != "dependabot[bot]":
53
+ log.debug("PR is not from dependabot", url=pr.html_url)
52
54
  return False
53
55
 
54
56
  last_commit = pr.get_commits().reversed[0]
@@ -57,43 +59,51 @@ def is_eligible_for_merge(pr: PullRequest):
57
59
 
58
60
  # status is different than CI runs!
59
61
  if len(combined_status.statuses) > 0 and status != "success":
62
+ log.debug("PR has failed status", url=pr.html_url, status=status)
60
63
  return False
61
64
 
62
65
  # checks are the CI runs
63
66
  all_checks_successful = (
64
- last_commit.get_check_runs() | fp.pluck_attr("conclusion") | fp.all("success")
67
+ last_commit.get_check_runs()
68
+ | fp.pluck_attr("conclusion")
69
+ | fp.all({"success", "skipped"})
65
70
  )
66
71
 
67
72
  if not all_checks_successful:
73
+ log.debug("PR has failed checks", url=pr.html_url)
68
74
  return False
69
75
 
70
76
  return True
71
77
 
72
78
 
73
79
  def process_repo(repo, dry_run):
74
- log.debug("checking repository", repo=repo.full_name)
80
+ with log.context(repo=repo.full_name):
81
+ log.debug("checking repository")
75
82
 
76
- if repo.fork:
77
- log.debug("skipping forked repo")
78
- return
83
+ if repo.fork:
84
+ log.debug("skipping forked repo")
85
+ return
79
86
 
80
- pulls = repo.get_pulls(state="open")
87
+ pulls = repo.get_pulls(state="open")
81
88
 
82
- if pulls.totalCount == 0:
83
- log.debug("no open prs, skipping")
84
- return
89
+ if pulls.totalCount == 0:
90
+ log.debug("no open prs, skipping")
91
+ return
85
92
 
86
- merged_pr_count = 0
93
+ merged_pr_count = 0
87
94
 
88
- for pr in pulls:
89
- if is_eligible_for_merge(pr):
90
- merge_pr(pr, dry_run)
95
+ for pr in pulls:
96
+ if is_eligible_for_merge(pr):
97
+ merge_pr(pr, dry_run)
91
98
 
92
- merged_pr_count += 1
93
- else:
94
- log.debug("skipping PR", url=pr.html_url)
99
+ merged_pr_count += 1
100
+ else:
101
+ log.debug("skipping PR", url=pr.html_url)
95
102
 
96
- log.info("merged prs", count=merged_pr_count)
103
+ if merged_pr_count == 0:
104
+ log.debug("no PRs were merged")
105
+ else:
106
+ log.info("merged prs", count=merged_pr_count)
97
107
 
98
108
 
99
109
  def main(token, dry_run, repo):
@@ -145,6 +155,14 @@ def dependabot(token, dry_run, repo):
145
155
 
146
156
 
147
157
  def pr_bumper():
158
+ """
159
+ Look at PRs which you have written:
160
+
161
+ 1. There are bots out there which will close the PR if there are is no activity, even if there is no activity from
162
+ the maintainer. This will keep the PR open by adding a comment.
163
+ 2. PRs that are not merged, been open for at least 30 days, with no comments from the maintainer.
164
+ """
165
+
148
166
  pass
149
167
 
150
168
 
@@ -64,7 +64,7 @@ def setup():
64
64
 
65
65
  configure_logger()
66
66
 
67
- log.info("application setup")
67
+ log.debug("application setup")
68
68
 
69
69
  # local state in a method is strange, but it works :/
70
70
  setup.complete = True
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "github-overlord"
3
- version = "0.3.2"
3
+ version = "0.3.3"
4
4
  description = "Automatically merge Dependabot PRs in public repositories"
5
5
  authors = ["Michael Bianco <mike@mikebian.co>"]
6
6
  readme = "README.md"