From 7538018a98f26ef49dc9b47933102010da02acc2 Mon Sep 17 00:00:00 2001 From: Harold Wanyama Date: Thu, 13 Apr 2023 17:34:00 +0300 Subject: [PATCH] [#3884] Feature/Co-Committer - Added co-committer in Github PR checks when gating Signed-off-by: Harold Wanyama --- cla-backend/cla/models/github_models.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/cla-backend/cla/models/github_models.py b/cla-backend/cla/models/github_models.py index 6565b5472..443e3035d 100644 --- a/cla-backend/cla/models/github_models.py +++ b/cla-backend/cla/models/github_models.py @@ -954,8 +954,21 @@ def get_pull_request_commit_authors(pull_request) -> List[UserCommitSummary]: ) cla.log.debug(f'{fn} - PR: {pull_request.number}, {commit_author_summary}') commit_authors.append(commit_author_summary) - # check for co-author details in the commit message: + # check for co-author details| committer in the commit message: # issue # 3884 + # committter different from the author + if commit.committer: + if commit.committer.id != commit.author.id: + commit_author_summary = UserCommitSummary( + commit.sha, + commit.committer.id, + commit.committer.login, + commit.committer.name, + commit.committer.email, + False, False # default not authorized - will be evaluated and updated later + ) + cla.log.debug(f'{fn} - Committer PR: {pull_request.number}, {commit_author_summary}') + commit_authors.append(commit_author_summary) co_authors = cla.utils.get_co_authors_from_commit(commit) for co_author in co_authors: # check if co-author is a github user