tools/merge_bot: Don't initiate merge just for recipe roller

Recipe roller has lead to many unwanted merge attempts. Don't start
a merge unless there are some other things to merge.

TEST=copy and paste in REPL for a manual mock test

BUG=b:333576491

Change-Id: Ia11c6706e98d60e6b4a908716a90cd4e04b55527
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5438909
Auto-Submit: Zihan Chen <zihanchen@google.com>
Commit-Queue: Zihan Chen <zihanchen@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
This commit is contained in:
Zihan Chen 2024-04-09 13:22:34 -07:00 committed by crosvm LUCI
parent f49e76b386
commit b23620ec88

View file

@ -212,6 +212,11 @@ def create_merge_commits(
if not commits:
print("Nothing to merge.")
return (0, False)
else:
commit_authors = git_log(f"HEAD..{revision}", "--pretty=%an").lines()
if all(map(lambda x: x == "recipe-roller", commit_authors)):
print("All commits are from recipe roller, don't merge yet")
return (0, False)
# Create a merge commit for each batch
batches = list(batched(commits, max_size)) if max_size > 0 else [commits]