Charlie-Greenman
Charlie-Greenman

Reputation: 1679

Create Code Owners for Github Pull Request before Pull Request is made

Using the CODEOWNERS syntax with github, creating a CODEOWNERS file in the root of the app, with the following syntax:

*  @CharlieGreenman

will make Charlie Greenman a code owner for the repo. It will therefore add Charlie Greenman as a code reviewer after pull request is made.

This approach, however, can be a bit misleading, as it does not add the reviewers during the pull request, and only after it has officially been made. Is there a way to either add a .yaml file, or modify the CODEOWNER file, so that the code owners are added during the pull request creation? Any help is more than appreciated. Thank you.

Upvotes: 0

Views: 715

Answers (1)

orepor
orepor

Reputation: 945

Well that wouldn't make much sense. The point of the CODEOWNERS file is to validate your files against the current codeowners.

Imagine you make a PR which removes the CODEOWNERS file entirely, In that case you would want atleast some CODEOWNER to approve that change wouldn't you?
In what you ask for, they wouldn't be aware of the change at all because you're deleting the file.

If you'd really like the change to happen before the PR, you could split it to 2 Pull Requests, one that changes the CODEOWNERS file, and one that changes the code.

Upvotes: 1

Related Questions