Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a GitHub issue from within R?

Tags:

github

r

Is there a way to create a GitHub issue from within R? I had a look at the GitHub API documentation. There is an endpoint for creating issues but I'm not sure how to translate that into R code.

like image 565
Thomas Neitmann Avatar asked Oct 11 '25 08:10

Thomas Neitmann


1 Answers

If your username is user and you have a repository called my-repo, then this code will create a new issue with the specified title and body text in the repo.

gh::gh(
  endpoint = "POST /repos/user/my-repo/issues",
  title = "Issue title",
  body = "Some text"
)

In order for this to work you need a GitHub access token. Once you created one make sure to add it to .Renviron, e.g. using usethis::edit_r_environ().

If you are using GitHub Enterpise then you will have to set the .api_url argument of gh::gh().

like image 114
Thomas Neitmann Avatar answered Oct 13 '25 21:10

Thomas Neitmann