codeowners-validator icon indicating copy to clipboard operation
codeowners-validator copied to clipboard

Check for user write access (also, more speed and less code!)

Open infinisil opened this issue 2 months ago • 1 comments

Description

This PR improves the owners check:

  • It now checks that users have write access (this notably was already done for teams, though undocumented)
    • Updated the README.md documentation to mention that
  • Speeds up the users check by not querying for all organisation members (gets just a bit slow if you have 3k members!), instead just querying the users with access to the repository
  • Simplify the team query code by just querying the teams with access to the repository

See the commits for more details.

Other than the locally runnable tests, I've also tested this minimally with an actual GitHub org repo

Related issue(s)

  • Fixes https://github.com/mszostok/codeowners-validator/issues/157
  • Fixes https://github.com/mszostok/codeowners-validator/issues/115, because the new API call used includes collaborators (and more).
    • Similarly, fixes https://github.com/mszostok/codeowners-validator/issues/73
  • Resolves https://github.com/mszostok/codeowners-validator/issues/21, there shouldn't be a need to switch to GraphQL with this
  • I haven't tested this, but this could fix this issue: https://github.com/mszostok/codeowners-validator/issues/194

This work is sponsored by Antithesis :sparkles:

infinisil avatar Apr 25 '24 18:04 infinisil