Anyway for GitHub api v3 to determine and give names of CODEOWNERS

https://help.github.com/en/articles/about-code-owners

From the above documentation I’m trying to determine code and file owners of a particular file. I haven’t been able to find anything that gives this information within the GitHub documentation.

The closest I found was this, https://stackoverflow.com/questions/20144295/github-api-v3-determine-if-user-is-an-owner-of-an-organization

But that seems to be answering a slightly different question.

Answers

I've built an npm library called codeowners-api which does this . So its not python but in JS.

If you want to use REST you would need to fetch the codeowners file from the Repo in question using Github's get-file API.

After that you take the file and you iterate over the codeowners file until you find the match. You can look at my library's code as reference.

I've also created a chrome extension which gives the reviewer a filter button to see only their relevant files.

https://chrome.google.com/webstore/detail/codeowners/mklphhfajjbikchaodnibnjmeibbonhb

Posted on by orepor

Relevant tags