-1

I am using Octokit Nuget Package for Github. I need to get the result as per the figure attached Github Details

I am using the following method for getting details of the Repository

public JsonResult GetRepositoryDeatil(long id)
    {
        var client = new GitHubClient(new ProductHeaderValue("demo"));
        var tokenAuth = new Credentials("xxxxxxx"); // NOTE: not real token
        client.Credentials = tokenAuth;
        var content = client.Repository.Content.GetAllContents(id).Result;
        List<RepositoryContent> objRepositoryContentList = content.ToList();

        return Json(objRepositoryContentList, JsonRequestBehavior.AllowGet);
    }

Output JSON can be viewed at the following link Output JSON

I am not able to get the commit details but only the directory or the file detail. Please suggest.

Thanks.

Manoj Sethi
  • 1,898
  • 8
  • 26
  • 56

1 Answers1

0

To get the current commit for a given branch, and the files that have changed:

var currentCommit = await client.Repository.Commit.Get(id, "master");
var commitMessage = currentCommit.Commit.Message;
var files = currentCommit.Files;

The timestamp is buried in the author and committer fields, but aren't surfaced in the C# library currently.

Brendan Forster
  • 2,548
  • 1
  • 24
  • 32