Skip to content
Merged
26 changes: 22 additions & 4 deletions src/main/java/org/kohsuke/github/GHRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ public PagedIterable<GHUser> listCollaborators(CollaboratorAffiliation affiliati

/**
* Lists all
* <a href="https://help.github.com/articles/assigning-issues-and-pull-requests-to-other-github-users/">the
* <a href= "https://help.github.com/articles/assigning-issues-and-pull-requests-to-other-github-users/">the
* available assignees</a> to which issues may be assigned.
*
* @return the paged iterable
Expand Down Expand Up @@ -2222,7 +2222,7 @@ public GHCommitStatus getLastCommitStatus(String sha1) throws IOException {
* @return check runs for given ref
* @throws IOException
* the io exception
* @see <a href="https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-specific-ref">List check runs
* @see <a href= "https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-specific-ref">List check runs
* for a specific ref</a>
*/
public PagedIterable<GHCheckRun> getCheckRuns(String ref) throws IOException {
Expand All @@ -2242,7 +2242,7 @@ public PagedIterable<GHCheckRun> getCheckRuns(String ref) throws IOException {
* @return check runs for the given ref
* @throws IOException
* the io exception
* @see <a href="https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-specific-ref">List check runs
* @see <a href= "https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-specific-ref">List check runs
* for a specific ref</a>
*/
public PagedIterable<GHCheckRun> getCheckRuns(String ref, Map<String, Object> params) throws IOException {
Expand Down Expand Up @@ -3568,7 +3568,8 @@ void populate() throws IOException {

// We don't use the URL provided in the JSON because it is not reliable:
// 1. There is bug in Push event payloads that returns the wrong url.
// For Push event repository records, they take the form "https://github.com/{fullName}".
// For Push event repository records, they take the form
// "https://github.com/{fullName}".
// All other occurrences of "url" take the form "https://api.github.com/...".
// 2. For Installation event payloads, the URL is not provided at all.

Expand Down Expand Up @@ -3649,6 +3650,23 @@ public List<GHRepositoryTrafficTopReferralSources> getTopReferralSources() throw
.fetch(GHRepositoryTrafficTopReferralSources[].class));
}

/**
* Get all active rules that apply to the specified branch
* (https://docs.github.com/en/rest/repos/rules?apiVersion=2022-11-28#get-rules-for-a-branch).
*
* @param branch
* the branch
* @return the rules for branch
* @throws IOException
* the io exception
*/
public PagedIterable<GHRepositoryRule> listRulesForBranch(String branch) throws IOException {
return root().createRequest()
.method("GET")
.withUrlPath(getApiTailUrl("/rules/branches/" + branch))
.toIterable(GHRepositoryRule[].class, null);
}

/**
* A {@link GHRepositoryBuilder} that allows multiple properties to be updated per request.
*
Expand Down
Loading