是否有人知道将github中特定标记的问题列表嵌入网站的简单方法?
这是在项目网站上嵌入一个开放式错误列表。
答案 0 :(得分:9)
使用jQuery的解决方案:
有一种方法可以轻松使用github api,只需使用javascript(无需设置github帐户,注册api令牌等)。
下面是一个小型演示,使用jquery获取github项目的所有开放错误列表(本例中为jquery)
var urlToGetAllOpenBugs = "https://api.github.com/repos/jquery/jquery/issues?state=open&labels=bug";
$(document).ready(function () {
$.getJSON(urlToGetAllOpenBugs, function (allIssues) {
$("div").append("found " + allIssues.length + " issues</br>");
$.each(allIssues, function (i, issue) {
$("div")
.append("<b>" + issue.number + " - " + issue.title + "</b></br>")
.append(issue.body + "</br></br></br>");
});
});
});
jsfiddle:http://jsfiddle.net/bso6xLee/2/
答案 1 :(得分:1)
您需要进行查询(例如&#34; Embedding Github's bug tracker within a website for the users to report directly from within the website&#34;) 然后,您将生成网站页面的html部分,该部分将显示该查询的结果。
GET /user/issues
使用您的帐户或仅查看您要列出问题的回购的帐户。
您可以指定标签
labels
string:逗号分隔的标签名称列表。示例:bug,ui,@high