ts-rust-zig-deez icon indicating copy to clipboard operation
ts-rust-zig-deez copied to clipboard

Code owners

Open ThePrimeagen opened this issue 2 years ago • 9 comments

I have to get this working... unsure when i will, but i will! Merged pr #90 for this, just never used codeowners as a way to manage the suppository, glad to try

ThePrimeagen avatar May 30 '23 19:05 ThePrimeagen

This CODEOWNERS file only starts being meaningful once people/orgs listed in it have write permissions to the repo.

And it's purpose is to manage branch protection rules: people listed there are automatically requested for review when someone opens a pull request that modifies code that they own as specified in it.

P.S.: Also, to decrease overall clutter in the root of the repo, that file could be moved to .github/ folder and it would still operate the same here on GitHub.

novusnota avatar May 30 '23 19:05 novusnota

@novusnota is this branch protection stuff automagic?

so if ShyRy is elixerdeez, he cannot merge a change with zig?

ThePrimeagen avatar May 30 '23 21:05 ThePrimeagen

@ThePrimeagen yes! But first one has to:

  1. Enable branch protection rule for master
  2. Check "Require pull requests before merging"
  3. Check "Require review from Code Owners"
  4. Validate the correctness of CODEOWNERS file (gitattributes-like format) — GitHub will tell something like "This CODEOWNERS file is valid" when viewing it from the web interface.

And then anytime anyone touches your Zig nuts, merging would be blocked until you explicitly grant your permission.

But if, say, ShyRy commits something for elixerdeez, GitHub would still require a review, but only from him and any other code owners assigned to elixerdeez in CODEOWNERS file. Self-admission, baby!

novusnota avatar May 30 '23 22:05 novusnota

Rules in a file work quite simple (like in CSS): successive rules override preceding ones.

Here's an example:

# You here are supreme code owner of everything
* @ThePrimeagen

# ShyRy with elixerdeez
/elixir/ @ryanwinchester

ShyRy here is now responsible for elixerdeez, so GitHub won't bother you when he edits his files, but if he starts editing anything else, which isn't /elixir, GitHub would require a code review from the related code owner. If there is none — it would require review from you.

novusnota avatar May 30 '23 22:05 novusnota

Is there a way to enable code owners to approve their own PRs (to the respective folders of course)? I have #43 that I would like to submit for Roc, and I am the code owner for Roc. I just can't submit cause it lacks review and I can't review my own PR. Maybe there is some other way to handle this?

bhansconnect avatar May 31 '23 13:05 bhansconnect

@bhansconnect yes, code owners also need to have write permissions to the repo for that

novusnota avatar May 31 '23 14:05 novusnota

Is codeowners setup completed? I don't see option to merge my own pull requests. Don't know if I doing it correct.

zivlakmilos avatar Jun 05 '23 22:06 zivlakmilos

Is codeowners setup completed? I don't see option to merge my own pull requests. Don't know if I doing it correct.

It's not completed yet, you can tag me for now if your PR is ready to be merged.

vhladko avatar Jun 06 '23 19:06 vhladko

Is codeowners setup completed? I don't see option to merge my own pull requests. Don't know if I doing it correct.

It's not completed yet, you can tag me for now if your PR is ready to be merged.

Any updates on this?

leo-costa avatar Jun 28 '23 03:06 leo-costa