Skip to content

Commit 24fa60f

Browse files
Handle commits with emails GitHub doesn't know. Also, hopefully
fix AdaBot's determination of its latest commit.
1 parent 1ae3f39 commit 24fa60f

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

adabot/circuitpython_bundle.py

+12-9
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ def update_bundle(bundle_path):
127127

128128
def commit_updates(bundle_path, update_info):
129129
working_directory = os.path.abspath(os.getcwd())
130-
os.chdir(bundle_path)
131130
message = ["Automated update by Adabot (adafruit/adabot@{})"
132131
.format(repo_version())]
132+
os.chdir(bundle_path)
133133
for url, old_commit, new_commit, summary in update_info:
134134
url_parts = url.split("/")
135135
user, repo = url_parts[-2:]
@@ -163,21 +163,24 @@ def get_contributors(repo, commit_range):
163163
if not author or not committer:
164164
github_commit_info = github.get("/repos/" + repo + "/commits/" + sha)
165165
github_commit_info = github_commit_info.json()
166-
author = github_commit_info["author"]["login"]
167-
committer = github_commit_info["committer"]["login"]
168-
redis.set("github_username:" + author_email, author)
169-
redis.set("github_username:" + committer_email, committer)
166+
if github_commit_info["author"]:
167+
author = github_commit_info["author"]["login"]
168+
redis.set("github_username:" + author_email, author)
169+
if github_commit_info["committer"]:
170+
committer = github_commit_info["committer"]["login"]
171+
redis.set("github_username:" + committer_email, committer)
170172
else:
171173
author = author.decode("utf-8")
172174
committer = committer.decode("utf-8")
173175

174176
if committer_email == "[email protected]":
175177
committer = None
176-
if author not in contributors:
178+
if author and author not in contributors:
177179
contributors[author] = 0
178180
if committer and committer not in contributors:
179181
contributors[committer] = 0
180-
contributors[author] += 1
182+
if author:
183+
contributors[author] += 1
181184
if committer and committer != author:
182185
contributors[committer] += 1
183186
return contributors
@@ -276,9 +279,9 @@ def new_release(bundle, bundle_path):
276279
os.chdir(working_directory)
277280

278281
if __name__ == "__main__":
279-
directory = ".bundles"
282+
directory = os.path.abspath(".bundles")
280283
for bundle in bundles:
281-
bundle_path = os.path.abspath(os.path.join(directory, bundle))
284+
bundle_path = os.path.join(directory, bundle)
282285
fetch_bundle(bundle, bundle_path)
283286
update_info = update_bundle(bundle_path)
284287
if update_info:

0 commit comments

Comments
 (0)