Skip to content

Commit

Permalink
Includes template_repository information fixes hub4j#1549
Browse files Browse the repository at this point in the history
  • Loading branch information
robinvandenbogaard committed Jan 25, 2023
1 parent de97437 commit 35b1e8c
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/main/java/org/kohsuke/github/GHRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public class GHRepository extends GHObject {
@SkipFromToString
private GHRepoPermission permissions;

private GHRepository source, parent;
private GHRepository source, parent, template_repository;

private Boolean isTemplate;
private boolean compareUsePaginatedCommits;
Expand Down Expand Up @@ -2894,6 +2894,27 @@ public GHRepository getParent() throws IOException {
return parent;
}

/**
* Repositories generated from a template have a 'template_repository' attribute that specifies the repository this
* repository is generated from. Only available in Detailed representations, not in Summary representations.
*
* @return {@link GHRepository} that points to the repository where this repository is generated from. Otherwise
* null.
* @throws IOException
* the io exception
*/
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior")
public GHRepository getTemplateRepository() throws IOException {
if (template_repository == null) {
populate();
}

if (template_repository == null) {
return null;
}
return template_repository;
}

/**
* Subscribes to this repository to get notifications.
*
Expand Down

0 comments on commit 35b1e8c

Please sign in to comment.