From c456617ddd0f55db2d45bd8f6e50bef7f583d36d Mon Sep 17 00:00:00 2001 From: Edward Lesmes Date: Fri, 19 Mar 2021 16:55:13 +0000 Subject: [PATCH] presubmit: Allow Bot-Commit+1 to self-approve change. Change-Id: I29a7aeb6f797be015f29e1e514bbe44988a1221e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2775839 Reviewed-by: Dirk Pranke Reviewed-by: Jason Clinton Commit-Queue: Edward Lesmes --- presubmit_canned_checks.py | 3 ++- presubmit_support.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py index d4714e5d4..f76848db0 100644 --- a/presubmit_canned_checks.py +++ b/presubmit_canned_checks.py @@ -1184,7 +1184,8 @@ def CheckOwners( ('\n '.join(suggested_owners)))) return output_list - if input_api.is_committing and not reviewers: + if (input_api.is_committing and not reviewers and + not input_api.gerrit.IsBotCommitApproved(input_api.change.issue)): return [output_fn('Missing LGTM from someone other than %s' % owner_email)] return [] diff --git a/presubmit_support.py b/presubmit_support.py index c53ed8fa1..3a05c4b8e 100755 --- a/presubmit_support.py +++ b/presubmit_support.py @@ -446,6 +446,9 @@ class GerritAccessor(object): return [v for v in label_info.get('all', []) if v.get('value', 0) == max_value] + def IsBotCommitApproved(self, issue): + return bool(self._GetApproversForLabel(issue, 'Bot-Commit')) + def IsOwnersOverrideApproved(self, issue): return bool(self._GetApproversForLabel(issue, 'Owners-Override'))