Search code examples
gitgithubversion-controlgithub-api

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


Is there an API for filing a GitHub issue?

When I have an unexpected issue I would like to offer the user an option to automatically report an issue.


Solution

  • Here is the GitHub API page which details how to programatically 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:

    {
      "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

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