GHContent#content always returns content from the master branch. Included sample code. Content 1 comes from master and 2 from the specified branch. Using github-api 1.62.
@Test
public void github_api_issue() throws Exception {
String branch = "mybranch";
GitHub github = GitHub.connectUsingPassword("myyser", "mypassword");
GHRepository ghRepo = github.getRepository("myrepo");
List<GHContent> contents = ghRepo.getDirectoryContent("myfolder", "heads/" + branch);
for (GHContent content : contents) {
String content1 = content.getContent();
String content2 = ghRepo.getFileContent(content.getPath(), branch).getContent();
System.out.println("Contents of " + content.getPath());
System.out.println("Content1");
System.out.println(content1);
System.out.println("Content2");
System.out.println(content2);
}
}
GHContent#content always returns content from the master branch. Included sample code. Content 1 comes from master and 2 from the specified branch. Using github-api 1.62.