{"id":20665608,"url":"https://github.com/thinkr-open/gitlabr","last_synced_at":"2025-03-17T15:12:16.141Z","repository":{"id":38196296,"uuid":"285833101","full_name":"ThinkR-open/gitlabr","owner":"ThinkR-open","description":"An R client for the GitLab API","archived":false,"fork":false,"pushed_at":"2024-05-17T11:32:16.000Z","size":1969,"stargazers_count":40,"open_issues_count":15,"forks_count":15,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-02T13:08:09.876Z","etag":null,"topics":["gitlab","r","r-package","rstats"],"latest_commit_sha":null,"homepage":"https://thinkr-open.github.io/gitlabr/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ThinkR-open.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-07T13:15:32.000Z","updated_at":"2024-08-07T12:33:07.000Z","dependencies_parsed_at":"2024-01-17T16:44:34.452Z","dependency_job_id":"f2bad67f-e299-4f73-98ed-bf2de3223cf5","html_url":"https://github.com/ThinkR-open/gitlabr","commit_stats":{"total_commits":385,"total_committers":18,"mean_commits":21.38888888888889,"dds":0.5116883116883117,"last_synced_commit":"02fe9d31b58f062020117dd9ef20f8ae0321fc04"},"previous_names":["statnmap/gitlabr"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThinkR-open%2Fgitlabr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThinkR-open%2Fgitlabr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThinkR-open%2Fgitlabr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThinkR-open%2Fgitlabr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ThinkR-open","download_url":"https://codeload.github.com/ThinkR-open/gitlabr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244056425,"owners_count":20390719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gitlab","r","r-package","rstats"],"created_at":"2024-11-16T19:32:43.588Z","updated_at":"2025-03-17T15:12:16.107Z","avatar_url":"https://github.com/ThinkR-open.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  cache = TRUE,\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\",\n  eval = Sys.getenv(\"GITLAB_COM_TOKEN\", unset = FALSE) # do not eval if token is not available\n)\n```\n\n# {gitlabr} \u003cimg src=\"man/figures/logo.png\" align=\"right\" alt=\"\" width=\"120\" /\u003e\n\n\u003c!-- badges: start --\u003e\n[![CRAN\\_Status\\_Badge](https://www.r-pkg.org/badges/version/gitlabr)](https://cran.r-project.org/package=gitlabr)\n![CRAN\\ Downloads\\ Badge](https://cranlogs.r-pkg.org/badges/gitlabr)\n[![codecov](https://codecov.io/gh/ThinkR-open/gitlabr/graph/badge.svg?token=EVRTX5LST9)](https://app.codecov.io/gh/ThinkR-open/gitlabr)\n[![R-CMD-check](https://github.com/ThinkR-open/gitlabr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ThinkR-open/gitlabr/actions/workflows/R-CMD-check.yaml)\n\u003c!-- badges: end --\u003e\n\nNever dreamt of creating and managing your GitLab projects from R? \n{gitlabr} is here to help you with that!  \nWith {gitlabr}, you can interact with GitLab's API to manage your projects, issues, merge requests, pipelines, wikis, and more.  \nNow, the automation of your regular tasks with GitLab is just a few lines of R code away.\n\n## Installation\n\nYou can install the most recent stable version from CRAN using:\n\n```{r, eval=FALSE}\ninstall.packages(\"gitlabr\")\n```\n\nTo install the development version using [devtools](https://cran.r-project.org/package=devtools), type:\n```{r, eval=FALSE}\ninstall.packages(\"gitlabr\", repos = \"https://thinkr-open.r-universe.dev\")\n```\n\nSee the [CONTRIBUTING.md](https://github.com/ThinkR-open/gitlabr/blob/main/CONTRIBUTING.md) for instructions on how to run tests locally and contributor information.\n\n## Recommended GitLab versions\n\nGitLab 11.6 or higher is generally recommended when using {gitlabr} version 2.0.0 or higher. This {gitlabr} version uses the GitLab API v4.\n\n## Quick Start Example\n\nR code using {gitlabr} to perform some common GitLab actions can look like this\n\n- Create a TOKEN on your GitLab instance with scopes: `api`\n  + For instance on gitlab.com: `https://gitlab.com/-/profile/personal_access_tokens`\n- Store your token in .Renviron as `GITLAB_COM_TOKEN` with `usethis::edit_r_environ()` and restart your session \n- Set a connection to GitLab instance\n```{r, cache=FALSE}\nlibrary(gitlabr)\n\n# You can verify your token works\n# Sys.getenv(\"GITLAB_COM_TOKEN\")\n\n# connect as a fixed user to a GitLab instance for the session\nset_gitlab_connection(\n  gitlab_url = \"https://gitlab.com\",\n  private_token = Sys.getenv(\"GITLAB_COM_TOKEN\")\n)\n```\n\n- Find the list of projects available to you\n  + Define a limit of pages of projects to search in with `max_page`, otherwise the entire GitLab.com will be downloaded here...\n  + Find all parameters available in the API for projects on this page: https://docs.gitlab.com/ee/api/projects.html\n    + For instance, we can set `owned = FALSE` to retrieve all projects except ours.\n```{r}\n# a tibble is returned, as is always by {gitlabr} functions\ngl_list_projects(max_page = 2, owned = FALSE)\n```\n\n### Work with a specific project\n\n- Explore one of your projects. You can set the name of the project or its ID. The ID is highly recommended, in particular if your project does not appear in the first pages of projects above. \n  + Let's explore [project \"repo.rtask\"](https://gitlab.com/statnmap/repo.rtask), with `ID = 20384533` on GitLab.com\n  \n```{r}\nmy_project \u003c- 20384533 # repo.rtask\",\n```\n\n- If the default branch is not named `main`, you need to specify it with `gitlabr_options_set()`\n\n```{r}\ngitlabr_options_set(\"gitlabr.main\", \"master\")\n```\n\n\n- List files of the project using `gl_list_files()`\n```{r}\ngl_list_files(project = my_project)\n```\n\n- List issues with `gl_list_issues()`\n\n```{r}\ngl_list_issues(project = my_project)\n```\n\n- Create an issue\n\n```{r, eval=FALSE}\n# create a new issue\nnew_feature_issue \u003c- gl_create_issue(project = my_project, title = \"Implement new feature\")\n\n# Your user ID\nmy_id \u003c- 0000000\n\n# assign issue to me\ngl_assign_issue(\n  project = my_project,\n  issue_id = new_feature_issue$iid,\n  assignee_id = my_id\n)\n\n# Verify new issue is here\ngl_list_issues(project = my_project, state = \"opened\")\n\n# close issue\ngl_close_issue(project = my_project, issue_id = new_feature_issue$iid)$state\n```\n\n_Note that recent version of GitLab may have anti-spam on opening issues, leading to ERROR with `gl_create_issue()` if you abuse the API. You will need to open the issue manually in this case._\n\n### Use additional requests\n\nIf an API request is not already available in {gitlabr}, function `gitlab()` allows to use any request of the GitLab API \u003chttps://docs.gitlab.com/ce/api/\u003e.\n\nFor instance, the API documentation shows how to create a new project in \u003chttps://docs.gitlab.com/ce/api/projects.html#create-project\u003e:\n\n- The verb is `POST`\n- The request is `projects`\n- Required attributes are `name` or `path` (if `name` not set)\n- `default_branch` is an attribute that can be set if wanted, but not required\n\nThe corresponding use of `gitlab()` is:\n\n```{r, eval=FALSE}\ngitlab(\n  req = \"projects\",\n  verb = httr::POST,\n  name = \"toto\",\n  default_branch = \"main\"\n)\n```\n\nImplement whatever suits your needs !\n\n### Unset connection\n\n```{r}\nunset_gitlab_connection()\n```\n\n## Using GitLab CI with {gitlabr}\n\n{gitlabr} can also be used to create a `.gitlab-ci.yml` file to test, build and check an R package, a bookdown, ... using GitLab's CI software. Use `gitlabr::use_gitlab_ci()` with a specific `type` in your project and your CI should be ready to start in the next commit.\n\nThere are pre-defined templates:  \n\n```{r echo=FALSE, results='asis'}\ncat(paste(\"-\", list.files(\"inst/gitlab-ci/\"), collapse = \"\\n\\n\"))\n```\n\n\n## Further information\n\n- For an introduction see the `vignette(\"a-gitlabr\", package = \"gitlabr\")`\n- When writing custom extensions (\"convenience functions\") for {gitlabr} or when you experience any trouble, the very extensive [GitLab API documentation](https://docs.gitlab.com/ce/api/) can be helpful.\n\n# Contributing to {gitlabr}\n\nYou're welcome to contribute to {gitlabr} by editing the source code, adding more convenience functions, filing issues, etc. [CONTRIBUTING.md](https://github.com/ThinkR-open/gitlabr/blob/main/CONTRIBUTING.md) compiles some information helpful in that process.\n\n\n## Code of Conduct\n\nPlease note that the gitlabr project is released with a [Contributor Code of Conduct](https://thinkr-open.github.io/gitlabr/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.\n\n\n_Note that the {gitlabr} package was originally created by [Jirka Lewandowski](https://github.com/jirkalewandowski/gitlabr). The present repository is a fork to be able to continue development of this package._  ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkr-open%2Fgitlabr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinkr-open%2Fgitlabr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkr-open%2Fgitlabr/lists"}