Skip to content

Not able to get the right file content #371

@vaibhavsw

Description

@vaibhavsw

I have a use case in which I get a commit id for a particular branch in a repository, but when I try to get the file content from that particular branch, I get the content for the same file from the master branch.

How to get a branch and get the file content from that branch only. Also, is it possible to get the branch and file content on the basis of commit id. Below is my code I use to get the file content

`

    GHContent props = null;
    try {
        props = ghBranch.getOwner().getFileContent("props.json");
    } catch (IOException e) {
        return Response.badRequest("Cannot find props.json at the root of project");
    }

    CustomProps props = convertorService.getProperties(props);
    return Response.ok(cloud);`

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