From afea290871ade50d6a2573be3cae23b5ac800ede Mon Sep 17 00:00:00 2001 From: Benjamin Denhartog Date: Fri, 1 Nov 2019 19:49:21 -0700 Subject: [PATCH] fix: prevent dpulicate entries in owners files for global owners this patch refactors the _GLOBAL_ODEOWNERS variable to a list, additionally refactoring the logic when appending _GLOBAL_OWNERS to the `teams` property of a `codeowners()` rule to ensure that users in _GLOBAL_OWNERS are not duplicated in the generated output. --- tools/defaults.bzl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/defaults.bzl b/tools/defaults.bzl index 88e15f8991..16ffb3c097 100644 --- a/tools/defaults.bzl +++ b/tools/defaults.bzl @@ -44,7 +44,9 @@ def npm_package(**kwargs): **kwargs ) -_GLOBAL_OWNERS = "@alexeagle" +_GLOBAL_OWNERS = [ + "@alexeagle", +] def codeowners(name = "OWNERS", no_parent = False, **kwargs): """Convenience macro to set some defaults @@ -62,7 +64,7 @@ def codeowners(name = "OWNERS", no_parent = False, **kwargs): # Googlers: see http://go/owners#noparent if not no_parent: - teams.append(_GLOBAL_OWNERS) + teams += [owner for owner in _GLOBAL_OWNERS if owner not in teams] _codeowners( name = name,