You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Manually add another user or team to the restriction using the GitHub UI
The app fails to apply the change (remove the manually added user/team) when trying to enforce the policy stated in the yaml
What is actually happening
"Error applying branch protection" in the log, with a 422 response with the following error from GitHub.
What is the expected behavior
"Branch protection applied successfully" in the log
Error output, if available
"data":{"message":"Invalid request.\n\nNo subschema in \"anyOf\" matched.\nFor 'items', {} is not a string.\nNot all subschemas of \"allOf\" matched.\nFor 'anyOf/1', {\"apps\"=>[], \"users\"=>[], \"teams\"=>[\"developers\", {}]} is not a null."
Context
Are you using the hosted instance of probot/settings or running your own?
My own
If running your own instance, are you using it with github.com or GitHub Enterprise?
github.com
Version of probot/settings
5.0.20-alpha.4
Version of GitHub Enterprise
N/A
Source
TL;DR;
compareDeep mutates its inputs
compareDeep produce unexpected results for lists
The reason for this bug is that mergeDeep.compareDeep mutates the given input that later on is sent to the GitHub API.
In my example, the function adds an empty object to the array branch.protection.restrictions.teams on this line:
When I set a breakpoint on that line, the branch.protection.restrictions.teams array is ["developers"], but after the call the it has been changed to ["developers", {}].
The return value from compareDeep also contains unexpected data.
When the yaml only has the team "developers" and current repo settings has one or more extra users/teams, the following result is generated:
If you have three teams, the first and second teams will be repeated once more for that iteration. This is obviously caused by the recursive call to compareDeep.
The text was updated successfully, but these errors were encountered:
Problem Description
When you remove a push restriction from a branch protection rule, the change can't be applied.
Test scenario A:
Test scenario B:
What is actually happening
"Error applying branch protection" in the log, with a 422 response with the following error from GitHub.
What is the expected behavior
"Branch protection applied successfully" in the log
Error output, if available
Context
Are you using the hosted instance of probot/settings or running your own?
My own
If running your own instance, are you using it with github.com or GitHub Enterprise?
github.com
Version of probot/settings
5.0.20-alpha.4
Version of GitHub Enterprise
N/A
Source
TL;DR;
The reason for this bug is that
mergeDeep.compareDeep
mutates the given input that later on is sent to the GitHub API.In my example, the function adds an empty object to the array
branch.protection.restrictions.teams
on this line:safe-settings/lib/plugins/branches.js
Line 50 in 15518fe
When I set a breakpoint on that line, the
branch.protection.restrictions.teams
array is["developers"]
, but after the call the it has been changed to["developers", {}]
.The return value from
compareDeep
also contains unexpected data.When the yaml only has the team "developers" and current repo settings has one or more extra users/teams, the following result is generated:
If there are two teams in the yaml, and one or more extra in the rule on GitHub, the invalid payload will be
teams:["developers", "marketing", {}]
.Also, the result of compareDeep is even more strange when having two teams in the yaml:
If you have three teams, the first and second teams will be repeated once more for that iteration. This is obviously caused by the recursive call to compareDeep.
The text was updated successfully, but these errors were encountered: