Skip to content

Commit

Permalink
fix: prevent dpulicate entries in owners files for global owners
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Benjamin Denhartog authored and alexeagle committed Nov 11, 2019
1 parent a9a2ebe commit afea290
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tools/defaults.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit afea290

Please sign in to comment.