All Projects → r-lib → Gh

r-lib / Gh

Licence: other
Minimalistic GitHub API client in R

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to Gh

Github To Sqlite
Save data from GitHub to a SQLite database
Stars: ✭ 116 (-24.18%)
Mutual labels:  github-api
Github Timeline
View other users' timeline
Stars: ✭ 131 (-14.38%)
Mutual labels:  github-api
Githunt Angular
An Apollo with Angular full-stack example app: vote for your favorite GitHub repos!
Stars: ✭ 144 (-5.88%)
Mutual labels:  github-api
Git Hub
Git command line interface to GitHub
Stars: ✭ 119 (-22.22%)
Mutual labels:  github-api
Reactnativetemplate
Our example of simple application using ReactNative and some recommendations
Stars: ✭ 127 (-16.99%)
Mutual labels:  github-api
Git Pull Request
git command to automatically pull github pull requests into their own branch
Stars: ✭ 132 (-13.73%)
Mutual labels:  github-api
Android Issue Reporter
A powerful and simple library to open issues on GitHub directly from your app.
Stars: ✭ 115 (-24.84%)
Mutual labels:  github-api
Php Github Api
A simple PHP GitHub API client, Object Oriented, tested and documented.
Stars: ✭ 1,914 (+1150.98%)
Mutual labels:  github-api
Fork Cleaner
Quickly clean up unused forks on your github account.
Stars: ✭ 129 (-15.69%)
Mutual labels:  github-api
Chronicler
A better way to write your release notes.
Stars: ✭ 138 (-9.8%)
Mutual labels:  github-api
Github Downloads Count
A script to get downloads count of your GitHub repositories
Stars: ✭ 120 (-21.57%)
Mutual labels:  github-api
Contributions.taminomartinius.de
Website to display a bunch of different commit statistics fetched by GitHub GraphQL API
Stars: ✭ 125 (-18.3%)
Mutual labels:  github-api
Gas Github
sync gas code to github
Stars: ✭ 2,069 (+1252.29%)
Mutual labels:  github-api
Blog
✒️记录技术的新博客,采用Vue3开发,使用GitHub API进行数据交互
Stars: ✭ 119 (-22.22%)
Mutual labels:  github-api
Monkey
Monkey is an unofficial GitHub client for iOS,to show the rank of coders and repositories.
Stars: ✭ 1,765 (+1053.59%)
Mutual labels:  github-api
Deployments
❗️GitHub Action for working painlessly with deployment statuses
Stars: ✭ 115 (-24.84%)
Mutual labels:  github-api
Gitfame
A Github contributions analyser
Stars: ✭ 131 (-14.38%)
Mutual labels:  github-api
Starring
⭐️ Automatically star the npm-packages that you are using on GitHub.
Stars: ✭ 153 (+0%)
Mutual labels:  github-api
Alize
Visualize Your Github Profile
Stars: ✭ 148 (-3.27%)
Mutual labels:  github-api
Github Audio
Listen to music generated by events happening across GitHub 🎷
Stars: ✭ 1,712 (+1018.95%)
Mutual labels:  github-api

gh

R-CMD-check Codecov test coverage CRAN RStudio mirror downloads

Minimalistic client to access GitHub’s REST and GraphQL APIs.

Installation

Install the package from CRAN as usual:

install.packages("gh")

Usage

library(gh)

Use the gh() function to access all API endpoints. The endpoints are listed in the documentation.

The first argument of gh() is the endpoint. You can just copy and paste the API endpoints from the documentation. Note that the leading slash must be included as well.

From https://docs.github.com/rest/reference/repos#list-repositories-for-a-user you can copy and paste GET /users/{username}/repos into your gh() call. E.g.

my_repos <- gh("GET /users/{username}/repos", username = "gaborcsardi")
vapply(my_repos, "[[", "", "name")
#>  [1] "alexr"        "altlist"      "argufy"       "disposables"  "dotenv"      
#>  [6] "falsy"        "franc"        "ISA"          "keypress"     "lpSolve"     
#> [11] "macBriain"    "maxygen"      "MISO"         "msgtools"     "notifier"    
#> [16] "oskeyring"    "parr"         "parsedate"    "prompt"       "r-font"      
#> [21] "r-source"     "rcorpora"     "roxygenlabs"  "sankey"       "secret"      
#> [26] "spark"        "standalones"  "svg-term"     "tamper"       "testthatlabs"

The JSON result sent by the API is converted to an R object.

Parameters can be passed as extra arguments. E.g.

my_repos <- gh(
  "/users/{username}/repos",
  username = "gaborcsardi",
  sort = "created")
vapply(my_repos, "[[", "", "name")
#>  [1] "oskeyring"    "testthatlabs" "lpSolve"      "roxygenlabs"  "standalones" 
#>  [6] "altlist"      "svg-term"     "franc"        "sankey"       "r-source"    
#> [11] "secret"       "msgtools"     "notifier"     "prompt"       "parr"        
#> [16] "tamper"       "alexr"        "argufy"       "maxygen"      "keypress"    
#> [21] "macBriain"    "MISO"         "rcorpora"     "disposables"  "spark"       
#> [26] "dotenv"       "parsedate"    "r-font"       "falsy"        "ISA"

POST, PATCH, PUT and DELETE requests

POST, PATCH, PUT, and DELETE requests can be sent by including the HTTP verb before the endpoint, in the first argument. E.g. to create a repository:

new_repo <- gh("POST /user/repos", name = "my-new-repo-for-gh-testing")

and then delete it:

gh("DELETE /repos/{owner}/{repo}", owner = "gaborcsardi",
   repo = "my-new-repo-for-gh-testing")

Tokens

By default the GITHUB_PAT environment variable is used. Alternatively, one can set the .token argument of gh().

Pagination

Supply the page parameter to get subsequent pages:

my_repos2 <- gh("GET /orgs/{org}/repos", org = "r-lib", page = 2)
vapply(my_repos2, "[[", "", "name")
#>  [1] "rcmdcheck"   "vdiffr"      "callr"       "mockery"     "here"       
#>  [6] "revdepcheck" "processx"    "vctrs"       "debugme"     "usethis"    
#> [11] "rlang"       "pkgload"     "httrmock"    "pkgbuild"    "prettycode" 
#> [16] "roxygen2md"  "pkgapi"      "zeallot"     "liteq"       "keyring"    
#> [21] "sloop"       "styler"      "ansistrings" "later"       "crancache"  
#> [26] "zip"         "osname"      "sessioninfo" "available"   "cli"

Environment Variables

  • The GITHUB_API_URL environment variable is used for the default github api url.
  • One of GITHUB_PAT or GITHUB_TOKEN environment variables is used, in this order, as default token.

License

MIT © Gábor Csárdi, Jennifer Bryan, Hadley Wickham

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].