Learn R Programming

⚠️There's a newer version (2.0.1) of this package.Take me there.

gitlabr

Installation

You can install the most recent stable version from CRAN using:

install.packages("gitlabr")

To install the development version using devtools), type:

library(devtools)
install_github("jirkalewandowski/gitlabr")

See the CONTRIBUTING.md for instructions on how to run tests locally and contributor information.

Recommended Gitlab versions

Gitlab 11.6 or higher is generally recommended when using gitlabr version 1.1.6 or higher. This gitlabr version uses the gitlab API v4, older versions of Gitlab using API v3 are still supported by gitlabr 0.9, see details section "API version" of the documentation of gl_connection on how to use them. From gitlabr 1.1.6 on API v3 is deprecated and will no longer be tested or maintained, although it is still present in the code. Also within API v4, changes have been made to the gitlab API, most notably for gitlabr, the session endpoint was removed. The versions of gitlabr will always be tested on the corresponding gitlab version, i.e. gitlabr 1.1.6 works best with gitlab 11.6. However, not for every nwe gitlab version there will be a gitlabr version.

Quick Start Example

R code using gitlabr to perform some easy, common gitlab actions can look like this:

library(gitlabr)

# connect as a fixed user to a gitlab instance
my_gitlab <- gl_connection("https://test-gitlab.points-of-interest.cc",
                           private_token = readLines("secrets/gitlab_token.txt"))
# a function is returned
# its first argument is the request (name or function), optionally followed by parameters

my_gitlab(gl_list_projects) # a data_frame is returned, as is always by gitlabr functions

my_gitlab(gl_list_files, project = "testor")

# create a new issue
new_feature_issue <- my_gitlab(gl_new_issue, project = "testor", "Implement new feature")

# requests via gitlabr always return data_frames, so you can use all common manipulations
require(dplyr)
example_user <-
  my_gitlab("users") %>%
    filter(username == "testuser")

# assign issue to a user
my_gitlab(gl_assign_issue, project = "testor",
          new_feature_issue$iid,
          assignee_id = example_user$id)

my_gitlab(gl_list_issues, "testor", state = "opened")

# close issue
my_gitlab(gl_close_issue, project = "testor", new_feature_issue$iid)$state

Further information

Copy Link

Version

Install

install.packages('gitlabr')

Monthly Downloads

1,052

Version

1.1.6

License

GPL (>= 3)

Maintainer

Jirka Lewandowski

Last Published

March 15th, 2019

Functions in gitlabr (1.1.6)

gl_ci_job

Define Gitlab CI jobs
gitlabr_0_7_renaming

renamings from gitlabr version 0.6.4 to 0.7
gl_pipelines

Access the Gitlab CI builds
gl_archive

Get zip archive of a specific repository
gl_get_comments

Get the comments/notes of a commit or issue
gl_connection

Connect to a specific gitlab instance API
gl_get_commits

Get commits and diff from a project repository
gl_list_branches

List, create and delete branches
gl_list_issues

Get issues of a project or user
gl_get_project_id

Get a project id by name
gitlab

Request Gitlab API
gl_list_projects

List projects in Gitlab
gl_proj_req

Create a project specific request
gl_to_issue_id

Translate projectwide issue id to global gitlab API issue id
gl_push_file

Upload a file to a gitlab repository
gl_repository

Access to repository functions and files in Gitlab API
set_gitlab_connection

Get/set a gitlab connection for all calls
glLoginInput

Shiny module to login to gitlab API
gitlabr

Interface to gitlab API on high and low levels
gitlabr-deprecated

Deprecated functions
gl_create_merge_request

Create a merge request
update_gitlabr_code

Convert gitlabr legacy code to 0.7 compatible
gl_new_issue

Post a new issue or edit one