Connect from R to gitlab: gitlabr on CRAN

29.10.2015

I wrote a convenient, yet flexible package to access the gitlab API from R: gitlabr, which is on CRAN now.

What is gitlab?

GitLab is a free and open-source alternative to GitHub, for hosting and viewing git repositories, managing issues and all it takes to collaborate on code. You can host an instance yourself or use gitlab.com. Gitlab comes with an API that gives you control over and access to your git repositories and all the management data stored alongside them: issues, milestones, users, comments, ...

What does gitlabr do?

With gitlabr you can

  • create issues, comments, ... in your gitlab directly from R, manually or automatically,
  • analyze repository, user activity, comment, ... data of your gitlab instance,
  • ... or do from within R everything you can do with gitlab HTTP API: http://doc.gitlab.com/ce/api/

gitlabr ...

  • ... provides you with access to the complete API of any Gitlab instance.
  • ... gives you an easy mechanism for connecting as a specific user to a specific Gitlab instance and issuing queries sparing you the details of the URLs and authentication process from there on.
  • ... comes with a number of convenient high-level functions for common tasks and a simple way to integrate your own into the package's mechanisms.
  • ... fully integrates with the R world by always returning data.frames.
  • ... allows you to program in your favorite style by providing a number of distinct idioms, all equally powerful.

How does code with gitlabr look like?

Here is a brief example, you can find more example code in the vignette:

library(gitlabr)

# connect as a fixed user to a gitlab instance
my_gitlab <- gitlab_connection("https://gitlab.points-of-interest.cc",
                               login = "nobody",
                               password = readLines("password.txt"))

list_projects(gitlab_con = my_gitlab)

list_files(project = "gitlabr", path = "R", gitlab_con = my_gitlab)

new_issue(project = "gitlabr", "Implement new feature", gitlab_con = my_gitlab)

How to get started