From 560efad701709cc57021ccb14f91a012c5e835d3 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Tue, 2 Aug 2022 16:35:36 +0000 Subject: [PATCH] workflows: Release Workflow - Avoid selecting random reviewers when no phab review 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/llvm/utils/git/github-automation.py b/llvm/utils/git/github-automation.py index 5225682..61e43c5 100755 --- a/llvm/utils/git/github-automation.py +++ b/llvm/utils/git/github-automation.py @@ -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, -- 2.7.4