Github存储库详细信息和回购ID [英] Github Repository Details with Repo ID

查看:120
本文介绍了Github存储库详细信息和回购ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为Github使用了Octokit Nuget Package。我需要根据附件中的数据得到结果

我使用以下方法获取Repository的详细信息

p>

  public JsonResult GetRepositoryDe​​atil(long id)
{
var client = new GitHubClient(new ProductHeaderValue(demo ));
var tokenAuth =新的凭证(xxxxxxx); //注意:不是真正的令牌
client.Credentials = tokenAuth;
var content = client.Repository.Content.GetAllContents(id).Result;
列表< RepositoryContent> objRepositoryContentList = content.ToList();

返回Json(objRepositoryContentList,JsonRequestBehavior.AllowGet);
}

输出JSON可以在以下链接中查看输出JSON



我无法获取提交详细信息,但只有目录或文件的细节。请提示。



感谢。

解决方案

对于给定的分支,以及已经改变的文件:

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

时间戳记埋藏在作者和提交者字段中,但当前不存在于C#库中。


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

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.

解决方案

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.

这篇关于Github存储库详细信息和回购ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆