Closed diequeiroz closed 2 years ago
Good catch @diequeiroz. The desired behaviour in this case should be to Continue with branch protection update if none is found
.
Ok, in this case there is also a undesired behavior that is:
1) A brach protection that is not in the exact pattern as default branch is found, such as *
2) The app creates a branch protection with the name of the default branch
3) We are left with two conflicting branch protections: *
and main
I can't seem to find info regarding what github does to decide which of the conflicting rules will be applied: https://github.com/github-community/community/discussions/12257
In this case I think the app should at all costs avoid creating a conflict, unless there is already a conflict that was created by a repo admin.
@SvanBoxel are you willing to have a take on this or should I setup the project and try to propose a change for both issues? I'm willing to do this, but node is not my strong suit.
I can't seem to find info regarding what github does to decide which of the conflicting rules will be applied: https://github.com/orgs/github-community/discussions/12257
Non-wildcards override wildcards. You cannot mix branch protection rules.
@SvanBoxel are you willing to have a take on this or should I setup the project and try to propose a change for both issues? I'm willing to do this, but node is not my strong suit.
Currently I don't have time to tackle this, but happy to review your code. If you're not comfortable with writing nodejs some pseudocode or diagram would be a great first step.
Thanks @diequeiroz
When a branch protection is not found for the default branch, the function should crash right here: https://github.com/SvanBoxel/organization-workflows/blob/main/src/utils/enforce-protection.ts#L28 since
protection
is undefined.What is the desired behavior in this case?
1) Continue with branch protection update if none is found or 2) The function should gracefully stop executing?
@SvanBoxel any thoughts on this?
Knowing the desired behavior is important to inform users that the branch protection should already exists when setting up an enforced organization workflow or the app should be able to create the protection if none exists.