Set default team permissions on new repositories? - github

When I create a repo on GitHub, it's almost always because I have code to push that is ready for review. But by default, only the organization admin can see a new repo right after it's been created. This prevents me from adding other reviewers to the PR that I create immediately after that.
Is there a way to set this up so that everyone on my team will appear in the list of potential reviewers for every new repo as it's created?

Related

Why am I able to push and send/receive pull requests but not on the contributor list in github?

I'm been working in a team of four. I'm in the collaborator list. I'm able to commit, push, send pull requests and merge in our repo. My teammates can see my changes, but everyone is on the contributor list except me.
I double checked my email address, make sure the email I used in my local setting is the same with my default email in the github account.
We have changed the owner of the project once, and I'm still using the old url. Is this the reason for that?
I found the github has a complex rule for you be considered as a contributor. Here's the doc of it.
https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-profile/managing-contribution-settings-on-your-profile/why-are-my-contributions-not-showing-up-on-my-profile
You have to commit to the main/default branch or make pull requests. To commit into other branches won't count.
Also, to use the old project url is definately one problem. In the project insight, everyone's profile is linked with their username. While mine is only a username with no user icon.
I think I just accidentally hit into one of the corner cases, but I'm still very confused of this design pattern.

Do you lose contributions of a project if you get removed from this project?

I can't seemed to find this information anywhere, but just wanna ask that if you are a contributor of a project and you worked on it so you can see all of those contributions on the chart, but then for whatever reason the owner of the project removed you, do you lose all of those contributions? as in will those green contribution grids(the days you work on it) go back to grey?
No, the contributions are based on the commit email ID, and do not have anything to do with the corresponding GitHub account having access to the repository. GitHub attributes a commit to a particular account if the email ID used with the commit is registered under that account.
So, unless the email IDs of past commits are in some way changed later, the contributions will still be visible, as long as the repository is public.
This also works the other way around. Anyone can set any email ID in their git configuration while committing, so it is trivial to falsely attribute commits to someone else, when viewing the contribution chart in GitHub.

GitHub PR Help. How to add user?

I have a PR that has been submitted that I have requested small updates/ changes to be made to. The user has switched GitHub profiles during the time the PR was open to the time I reviewed the PR. He now wants to be able to submit the changes to the PR as his new username. Is there a way to give the new user write access to the PR?
Here is a link to the PR for reference.

If you add a collaborator to a github public repo can they delete or damage anything?

We are setting up a open source project which we would like to allow freelancers to develop alongside us without damaging anything.
In general can the collaborators make changes to repositories without admins being able to check the changes over before code is merged into master.
What is the best method to use to prevent the repository from user damage whilst working with a large number of public freelance developers / users?
What you can do is you can give them read-only permission. They can fork to their own account and start working on that code. Then after finishing a feature they can create a pull request to merge it back to the main repo.
For a Personal account on Github, there are two types of 'roles' - Owner and Collaborator.
For a full list of who can do what - see here:
https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-personal-account-settings/permission-levels-for-a-personal-account-repository
To answer your question - "No - A collaborator cannot delete a repository"

Adding default reviewers to Github repository

I followed the instructions here https://help.github.com/articles/about-codeowners/ but it doesn't seem to work. I even added the CODEOWNERS file at both the root and .github directory. The reviewers specified in the CODEOWNERS file are not selected automatically when a pull request is created. See screenshots below. Onyone who has set this up, could you point to where the problem is. Thank you.
You need to be sure that your base branch has:
the 'Protect this branch' flag activated
the 'Require pull request reviews before merging' flag activated
the 'Require review from Code Owners' flag activated
Then in the CODEOWNERS file, located either in the root of the repo or in the .github subfolder, you need to have either a user described with '#user', a user described with his email like 'user#domain.com', or a team described with '#org/teamname'.
You will need also to be sure that:
your contributors (users and teams) have for each of them the 'write' access to the repo
the team is not a 'secret' team, only the 'visible' teams would be taken into account
Double-check the CODEOWNERS file syntax
The pattern is followed by one or more GitHub usernames or team names using the standard #username or #org/team-name format.
(I don't see # in your case)
You can also refer to a user by an email address that has been added to their GitHub account, for instance user#example.com.
If the syntax is correct, then you can contact GitHub support to have them investigate.
The OP Pratheep actually find this is working:
You need the # and referring to my last screenshot above, you don't see the reviewers in the list when creating the PR.
But once the PR is created, then you will see the reviewers in the list.
I believe it was by design not to show. Because if you show the reviewers in that list before the PR is created, the names can be removed.
This way no one can create a PR without notifying the codeowners/default reviewers.