如何让用户从我的Github页面本身打开问题?
因此,我希望它能够像用户在我的网站http://example.github.io/上访问并单击显示“打开问题”之类的按钮一样,将其带到我网站上的状态良好的表单中,并在用户提交之后它会打开一个关于他们输入的信息的问题。
答案 0 :(得分:0)
described here的一种方法是:
POST /repos/:owner/:repo/issues
)例如:
function onFormSubmit(e) {
var itemResponses = e.response.getItemResponses();
var item1 = itemResponses[1].getResponse();
var item2 = itemResponses[2].getResponse();
var item3 = itemResponses[3].getResponse();
var item4 = itemResponses[4].getResponse();
var item5 = itemResponses[5].getResponse();
var item6 = itemResponses[6].getResponse();
var item7 = itemResponses[7].getResponse();
var item8 = itemResponses[8].getResponse();
var title = "Bug: " + item2;
var body =
"<strong>Submitted By: </strong>" + item1 +
"\n<strong>url: </strong>" + item3 +
"\n<strong>device: </strong>" + item4 +
"\n<strong>browser: </strong>" + item5 +
"\n<strong>expected behavior: </strong>" + item6 +
"\n<strong>actual behavior: </strong>" + item7 +
"\n<strong>steps to reproduce: </strong>" + item8;
var payload = {
"title": title,
"body": body
};
var options = {
"method": "POST",
"contentType": "application/json",
"payload": JSON.stringify(payload)
};
var response = UrlFetchApp.fetch("https://api.github.com/repos/EXAMPLE?access_token="+ghToken, options);
}