mszostok / codeowners-validator

The GitHub CODEOWNERS file validator
Apache License 2.0
221 stars 47 forks source link

update valid owner check to page through teams #23

Closed jhump closed 4 years ago

jhump commented 4 years ago

The existing code only downloads 1 page of results when trying to list an organization's teams. By default, a page is only 30 items. So organizations with >30 teams may have some teams that are not visible to the check. This causes the checker to think a config is invalid even if it actually is valid.

This change (1) sets the requested page size to 100 (the max), to reduce GitHub API calls; (2) adds a cache of teams by org to the checker struct, again, to reduce API calls to GitHub; and (3) iterates until the response indicates that there are no more pages.

jhump commented 4 years ago

@mszostok, any chance you could review this fix?

I am in a GitHub organization that has enough teams that we just hit this: we added two new teams but this tool reported our CODEOWNERS as broken when we tried to refer to the new teams. And the reason is because the new teams ended up on "page 2" of team results.

mszostok commented 4 years ago

Hi @jhump sorry for such late response, somehow I didnt notice that 🤦‍♂

I will check that this weekend and do new release.

once again really sorry. I will update readme how you can ping me:

but I will also pay more attention to that repo and change notification.

jhump commented 4 years ago

@mszostok, no worries. I'm patient! :)