简体   繁体   English

GitHub:有没有办法以编程方式提交问题?

[英]GitHub: Is there a way to programmatically file an issue?

Is there an API for filing a GitHub issue?是否有用于提交 GitHub 问题的 API?

When I have an unexpected issue I would like to offer the user an option to automatically report an issue.当我遇到意外问题时,我想为用户提供一个自动报告问题的选项。

Here is the GitHub API page which details how to programatically create an issue:这是 GitHub API 页面,其中详细介绍了如何以编程方式创建问题:

https://developer.github.com/v3/issues/#create-an-issue https://developer.github.com/v3/issues/#create-an-issue

Example, from the docs:示例,来自文档:

Send a POST request to /repos/:owner/:repo/issues with JSON like the following:使用 JSON 向/repos/:owner/:repo/issues发送 POST 请求,如下所示:

{
  "title": "Found a bug",
  "body": "I'm having a problem with this.",
  "assignee": "octocat",
  "milestone": 1,
  "labels": [
    "Label1",
    "Label2"
  ]
}

You can also edit issues programatically by sending a PATCH request to /repos/:owner/:repo/issues/:number您还可以通过向/repos/:owner/:repo/issues/:number发送 PATCH 请求以编程方式编辑问题

Source: https://developer.github.com/v3/issues/#edit-an-issue来源: https : //developer.github.com/v3/issues/#edit-an-issue

You can also use (2021) the GitHub CLI ' gh '您还可以使用 (2021) GitHub CLI ' gh '

In your case: gh issue create .在您的情况下: gh issue create

Example:例子:

gh issue create --title "I found a bug" --body "Nothing works"

(Hopefully, your issue description would be slightly more detailed than that!) (希望您的问题描述会比这更详细一些!)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM