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

问题描述 投票:0回答:2

是否有用于提交 GitHub 问题的 API?

当我遇到意外问题时,我想为用户提供自动报告问题的选项。

git github version-control github-api
2个回答
11
投票

这里是 GitHub API 页面,详细介绍了如何以编程方式创建问题:

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

示例,来自文档:

使用 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"
  ]
}

您还可以通过向

/repos/:owner/:repo/issues/:number

发送 PATCH 请求以编程方式编辑问题

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


1
投票

您还可以使用 (2021) GitHub CLI '

gh
'

就您而言:

gh issue create

示例:

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

(希望您的问题描述能比这更详细一些!)


2024:

gh
v2.53.0 添加了PR 7193(解决问题 390):

gh issue create --editor

跳过提示并打开文本编辑器以写入标题和正文。
第一行是标题,其余文本是正文。

© www.soinside.com 2019 - 2024. All rights reserved.