workflows: Release Workflow - Avoid selecting random reviewers when no phab review
authorTom Stellard <tstellar@redhat.com>
Tue, 2 Aug 2022 16:35:36 +0000 (16:35 +0000)
committerTom Stellard <tstellar@redhat.com>
Tue, 2 Aug 2022 21:07:22 +0000 (14:07 -0700)
If you pass a NULL reivew ID to the differential.revision.search API,
it returns all revisions and we were just taking the first one and
assuming it was associated with the commit in the PR.

We need to exit early if we can't find a Phabricator review associated
with a commit.

llvm/utils/git/github-automation.py

index 5225682..61e43c5 100755 (executable)
@@ -99,6 +99,9 @@ def phab_get_commit_approvers(phab_token:str, repo:github.Repository.Repository,
     # API documentation: https://reviews.llvm.org/conduit/method/differential.parsecommitmessage/
     r = phab_api_call(phab_token, "https://reviews.llvm.org/api/differential.parsecommitmessage", args)
     review_id = r['result']['revisionIDFieldInfo']['value']
+    if not review_id:
+        # No Phabricator revision for this commit
+        return []
 
     args = {
         'constraints[ids][0]' : review_id,