MyNixOS website logo
Description

Client to the 'gitea' API.

'Gitea' is a community managed, lightweight code hosting solution were projects and their respective git repositories can be managed <https://gitea.io>. This package gives an interface to the 'Gitea' API to access and manage repositories, issues and organizations directly in R.

gitear

CRANstatus Travis buildstatus Codecov testcoverage

The goal of gitear is to request your self-hosted Git service data and import it to R in a tidy data frame.

gitear is a package that communicates with the gitea API.

Installation

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("ixpantia/gitear")

Usage

First go to your gitea self hosted service and grab your API Token. Then you should be able to the following:

# Credentials

api_token <- "gfdsgfd8ba18a866bsdfgsdfgs3a2dc9303453b0c92dcfb19"
url_ixpantia <- "https://prueba.com"

# Example function use

issues <- get_issues(base_url = url_ixpantia,
                     api_key = api_token,
                     owner = "empresa",
                     repo = "repo_prueba")


issues
#>   number                      title created_date created_time updated_date
#> 1      3 Primer tiquete para prueba   2020-07-15     23:43:42   2020-07-24
#> 2      2 Primer tiquete para prueba   2020-07-15     23:12:37   2020-07-24
#>   updated_time             due_date author assignee
#> 1     14:41:47 2020-07-31T23:59:59Z   juan     juan
#> 2     14:41:37 2020-07-31T23:59:59Z   juan     juan

Environmental variables:

In order to work with environmental variables to make your scripts safer from somebody getting your credentials, you can follow the next workflow:

  1. Create an .Renviron file with your credentials
  2. Restart your R session
  3. Store your credentials in an object for using it in your script

Your script could look something like this:

# Storing credentials in an object

example_key <- Sys.getenv("example_key")
example_url <- Sys.getenv("example_url")

# Using a function from gitear

issues <- get_issues(base_url = example_url,
                     api_key = example_key,
                     owner = "empresa",
                     repo = "repo_prueba")

# Check the output

glimpse(issues)
#> Rows: 2
#> Columns: 9
#> $ number       <int> 3, 2
#> $ title        <chr> "Primer tiquete para prueba", "Primer tiquete para pru...
#> $ created_date <chr> "2020-07-15", "2020-07-15"
#> $ created_time <chr> "23:43:42", "23:12:37"
#> $ updated_date <chr> "2020-07-24", "2020-07-24"
#> $ updated_time <chr> "14:41:47", "14:41:37"
#> $ due_date     <chr> "2020-07-31T23:59:59Z", "2020-07-31T23:59:59Z"
#> $ author       <chr> "juan", "juan"
#> $ assignee     <chr> "juan", "juan"
Metadata

Version

1.0.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows