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
Describe the bug
When running the API with owner privilege, it does not seem to work properly and always return 0 regardless of what the actual required approving required is set to.
To Reproduce
Steps to reproduce the behavior:
To reproduce the problem.
As a repo owner, enable Branch Protection and configure required approving required to 1 or more
Use repo owner token to log in and run the following code with Owner privilege on github,
Describe the bug
When running the API with owner privilege, it does not seem to work properly and always return 0 regardless of what the actual required approving required is set to.
To Reproduce
Steps to reproduce the behavior:
To reproduce the problem.
GHRepository ghrepo = github.getRepository(repo);
GHBranch ghbranch = ghrepo.getBranch(branch);
GHBranchProtection protection = ghbranch.getProtection();
RequiredReviews requiredReviews = protection.getRequiredReviews();
int reviewers = requiredReviews.getRequiredReviewers();
The call succeeded without exception, but reviewers is always 0
Expected behavior
The API should return the actual required approving review numbers as configured in github repository
Desktop (please complete the following information):
Additional context
I suspect request heading is not configured correctly when trying to retrieve this property.
According to github api branch protection documentation: https://developer.github.com/v3/repos/branches/#get-branch-protection
A special header "application/vnd.github.luke-cage-preview+json" must be used to retrieve the number of approving pull request. But request builder for GHBranchProtection does not seem to handle it.
This is an existing example on how to handled this in GHBranchProtectionBuilder :
https://github.com/hub4j/github-api/blob/6bc617c488e96ea4e8040b54754f13ec68356bbe/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java#L355,L357
Please investigate if it can be done for GHBranchProtection as well
The text was updated successfully, but these errors were encountered: