Skip to content

GHContent#content always returns master version #162

@tilayealemu

Description

@tilayealemu

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);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions