mszostok / codeowners-validator

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

Add support for outside collaborators #115

Open mszostok opened 2 years ago

mszostok commented 2 years ago

Description

There is an option to add people as outside collaborators.

The codeowners-validator should include those members when in owners check as currently they are ignored.

Reasons

Currently, owners check my produce false negatives when CODEOWNRES files has outside collaborators as owners.

bobertrublik commented 1 year ago

I would help out with a PR for this issue. I looked into the code and I can do one of the following:

  1. Add an outsideCollaborators map variable to ValidOwners struct and a function which adds all outside collaborators part of the repository to the map. Inside function Check in valid_owner.go we can then continue the for loop on any outside collaborators with access to the repository. The second option is validating outside collaborators in validateGitHubUser().
  2. Create a second initOrgListMembers() function which adds outside collaborators to the orgMembers map. This joins organization members with outside collaborators and the check succeeds in validateGitHubUser().

I would probably prefer option 1 since we can differentiate between different types of users. What do you think?