From 5aa165f21b92dde2a079c9f3212002702a93817b Mon Sep 17 00:00:00 2001 From: James J Balamuta Date: Sun, 5 Jan 2020 09:35:35 -0600 Subject: [PATCH] Refresh ghapi3 package (#8) * Update package level documentation * Update DESCRIPTION file * Re-build documentation * Remove TravisCI * Add R CMD Check * Add GitHub Actions * Update README format --- .github/workflows/R-CMD-check.yaml | 66 ++++++++++++++++++++++++++++++ .github/workflows/pr-commands.yaml | 47 +++++++++++++++++++++ .travis.yml | 8 ---- DESCRIPTION | 26 +++++++----- NEWS.md | 5 +++ R/ghapi3-package.R | 7 ++++ README.Rmd | 18 ++++---- README.md | 21 ++++++---- man/add_collaborator.Rd | 8 +++- man/get_collaborator_list.Rd | 3 +- man/get_org_members_list.Rd | 7 +++- man/get_org_repos_list.Rd | 6 ++- man/get_self_repos_list.Rd | 10 +++-- man/get_user_repos_list.Rd | 8 +++- man/ghapi3-package.Rd | 10 +++-- man/org-invites.Rd | 18 +++++--- man/repo-creation.Rd | 44 ++++++++++++++------ 17 files changed, 242 insertions(+), 70 deletions(-) create mode 100644 .github/workflows/R-CMD-check.yaml create mode 100644 .github/workflows/pr-commands.yaml delete mode 100644 .travis.yml create mode 100644 NEWS.md diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml new file mode 100644 index 0000000..33a7f53 --- /dev/null +++ b/.github/workflows/R-CMD-check.yaml @@ -0,0 +1,66 @@ +on: [push, pull_request] + +name: R-CMD-check + +jobs: + R-CMD-check: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + - { os: windows-latest, r: 'release'} + - { os: windows-latest, r: 'devel'} + - { os: macOS-latest, r: 'release'} + - { os: macOS-latest, r: 'devel'} + - { os: ubuntu-16.04, r: '3.5', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"} + - { os: ubuntu-16.04, r: 'release', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"} + + env: + R_REMOTES_NO_ERRORS_FROM_WARNINGS: true + CRAN: ${{ matrix.config.cran }} + + steps: + - uses: actions/checkout@v1 + + - uses: r-lib/actions/setup-r@master + with: + r-version: ${{ matrix.config.r }} + + - uses: r-lib/actions/setup-pandoc@master + + - name: Cache R packages + if: runner.os != 'Windows' + uses: actions/cache@v1 + with: + path: ${{ env.R_LIBS_USER }} + key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('DESCRIPTION') }} + + - name: Install system dependencies + if: runner.os == 'Linux' + env: + RHUB_PLATFORM: linux-x86_64-ubuntu-gcc + run: | + Rscript -e "install.packages('remotes')" -e "remotes::install_github('r-hub/sysreqs')" + sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))") + sudo -s eval "$sysreqs" + - name: Install dependencies + run: Rscript -e "install.packages('remotes')" -e "remotes::install_deps(dependencies = TRUE)" -e "remotes::install_cran('rcmdcheck')" + + - name: Check + run: Rscript -e "rcmdcheck::rcmdcheck(args = '--no-manual', error_on = 'warning', check_dir = 'check')" + + - name: Upload check results + if: failure() + uses: actions/upload-artifact@master + with: + name: ${{ runner.os }}-r${{ matrix.config.r }}-results + path: check + + #- name: Test coverage + # if: matrix.config.os == 'macOS-latest' && matrix.config.r == 'release' + # run: | + # Rscript -e 'covr::codecov(token = "${{secrets.CODECOV_TOKEN}}")' diff --git a/.github/workflows/pr-commands.yaml b/.github/workflows/pr-commands.yaml new file mode 100644 index 0000000..2b2eebc --- /dev/null +++ b/.github/workflows/pr-commands.yaml @@ -0,0 +1,47 @@ +on: + issue_comment: + types: [created] +name: Commands +jobs: + document: + if: startsWith(github.event.comment.body, '/document') + name: document + runs-on: macOS-latest + steps: + - uses: actions/checkout@v1 + - uses: r-lib/actions/pr-fetch@master + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - uses: r-lib/actions/setup-r@master + - name: Install dependencies + run: Rscript -e 'install.packages(c("remotes", "roxygen2"))' -e 'remotes::install_deps(dependencies = TRUE)' + - name: Document + run: Rscript -e 'roxygen2::roxygenise()' + - name: commit + run: | + git add man/\* NAMESPACE + git commit -m 'Document' + - uses: r-lib/actions/pr-push@master + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + style: + if: startsWith(github.event.comment.body, '/style') + name: document + runs-on: macOS-latest + steps: + - uses: actions/checkout@master + - uses: r-lib/actions/pr-fetch@master + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - uses: r-lib/actions/setup-r@master + - name: Install dependencies + run: Rscript -e 'install.packages("styler")' + - name: style + run: Rscript -e 'styler::style_pkg()' + - name: commit + run: | + git add \*.R + git commit -m 'style' + - uses: r-lib/actions/pr-push@master + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 756ad0f..0000000 --- a/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -# R for travis: see documentation at https://docs.travis-ci.com/user/languages/r - -language: R -sudo: false -cache: packages - -after_success: - - Rscript -e 'covr::codecov()' diff --git a/DESCRIPTION b/DESCRIPTION index 272dbb5..1589266 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,17 +1,23 @@ Package: ghapi3 Title: GitHub v3 API Implementation Version: 0.0.1 -Authors@R: c(person("James", "Balamuta", - email = "balamut2@illinois.edu", role = c("aut", "cre", "cph")), - person("GitHub", "Inc.", email = "support@github.com", role = c("cph"))) -Description: Provides access to GitHub API v3.0 using the gh package backend. -URL: https://github.com/coatless/ghapi -BugReports: https://github.com/coatless/ghapi/issues +Authors@R: c( + person("James", "Balamuta", + email = "balamut2@illinois.edu", + role = c("aut", "cre", "cph"), + comment = c(ORCID = "0000-0003-2826-8458")), + person("GitHub", "Inc.", + email = "support@github.com", role = c("cph")) + ) +Description: Provides access to select GitHub API v3.0 endpoints using + the 'gh' package backend. +License: GPL (>= 2) +URL: https://github.com/coatless/ghapi3 +BugReports: https://github.com/coatless/ghapi3/issues Depends: R (>= 3.4.0) Imports: gh -License: GPL (>= 2) -Encoding: UTF-8 -LazyData: true -RoxygenNote: 6.1.1 Suggests: covr, testthat +Encoding: UTF-8 +LazyData: true +RoxygenNote: 7.0.2 diff --git a/NEWS.md b/NEWS.md new file mode 100644 index 0000000..4f79eee --- /dev/null +++ b/NEWS.md @@ -0,0 +1,5 @@ +# ghapi3 0.0.1 + +## Deployment + +- CI is done using GitHub Actions. diff --git a/R/ghapi3-package.R b/R/ghapi3-package.R index 0ae1a57..e8408e7 100644 --- a/R/ghapi3-package.R +++ b/R/ghapi3-package.R @@ -1,3 +1,10 @@ +#' @keywords internal #' @details #' This package requires users have access to a GitHub Personal Access Token (PAT) "_PACKAGE" + +# The following block is used by usethis to automatically manage +# roxygen namespace tags. Modify with care! +## usethis namespace: start +## usethis namespace: end +NULL diff --git a/README.Rmd b/README.Rmd index 765afd5..71ebf8f 100644 --- a/README.Rmd +++ b/README.Rmd @@ -13,28 +13,30 @@ knitr::opts_chunk$set( ``` -[![Travis-CI Build Status](https://travis-ci.org/coatless/ghapi3.svg?branch=master)](https://travis-ci.org/coatless/ghapi3) + +[![R build +status](https://github.com/coatless/ghapi3/workflows/R-CMD-check/badge.svg)](https://github.com/coatless/ghapi3/actions) [![CRAN RStudio mirror downloads](http://cranlogs.r-pkg.org/badges/ghapi3)](http://www.r-pkg.org/pkg/ghapi3) [![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/ghapi3)](https://cran.r-project.org/package=ghapi3) [![Coverage Status](https://img.shields.io/codecov/c/github/coatless/ghapi3/master.svg)](https://codecov.io/github/coatless/ghapi3?branch=master) + - -# `ghapi3` +## ghapi3 The goal of `ghapi3` is to provide a full-featured interface to GitHub's API v3.0. To do this, we use the [`gh`](https://github.com/r-lib/gh) _R_ package to access the GitHub API's methods. -## Installation +### Installation You can install `ghapi3` from github with: ```{r gh-installation, eval = FALSE} -# install.packages("devtools") -devtools::install_github("coatless/ghapi3") +if(!requireNamespace("remotes", quietly = TRUE)) { install.packages("remotes") } +remotes::install_github("coatless/ghapi3") ``` -## Implementation +### Implementation We have support presently for: @@ -53,6 +55,6 @@ knitr::kable(funcs) ``` -## License +### License GPL (>= 2) diff --git a/README.md b/README.md index 766627c..e62bded 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,33 @@ -[![Travis-CI Build -Status](https://travis-ci.org/coatless/ghapi3.svg?branch=master)](https://travis-ci.org/coatless/ghapi3) + + +[![R build +status](https://github.com/coatless/ghapi3/workflows/R-CMD-check/badge.svg)](https://github.com/coatless/ghapi3/actions) [![CRAN RStudio mirror downloads](http://cranlogs.r-pkg.org/badges/ghapi3)](http://www.r-pkg.org/pkg/ghapi3) [![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/ghapi3)](https://cran.r-project.org/package=ghapi3) [![Coverage Status](https://img.shields.io/codecov/c/github/coatless/ghapi3/master.svg)](https://codecov.io/github/coatless/ghapi3?branch=master) + -# `ghapi3` +## ghapi3 The goal of `ghapi3` is to provide a full-featured interface to GitHub’s API v3.0. To do this, we use the [`gh`](https://github.com/r-lib/gh) *R* package to access the GitHub API’s methods. -## Installation +### Installation You can install `ghapi3` from github with: ``` r -# install.packages("devtools") -devtools::install_github("coatless/ghapi3") +if(!requireNamespace("remotes", quietly = TRUE)) { install.packages("remotes") } +remotes::install_github("coatless/ghapi3") ``` -## Implementation +### Implementation We have support presently for: @@ -36,11 +39,11 @@ We have support presently for: | browse\_commit\_diff | | check\_org\_private\_membership | | check\_org\_public\_membership | -| create\_commit\_diff\_url | | create\_org\_invitation\_email | | create\_org\_invitation\_ghname | | create\_org\_repo | | create\_tag | +| create\_url\_commit\_diff | | create\_user\_repo | | get\_collaborator\_list | | get\_contributors\_list | @@ -59,6 +62,6 @@ We have support presently for: | transfer\_repo | | update\_org\_member\_role | -## License +### License GPL (\>= 2) diff --git a/man/add_collaborator.Rd b/man/add_collaborator.Rd index bc16b0d..df5b531 100644 --- a/man/add_collaborator.Rd +++ b/man/add_collaborator.Rd @@ -4,8 +4,12 @@ \alias{add_collaborator} \title{Add a Collaborator to a Repository} \usage{ -add_collaborator(owner, repo, username, permission = c("push", "pull", - "admin")) +add_collaborator( + owner, + repo, + username, + permission = c("push", "pull", "admin") +) } \arguments{ \item{owner}{Name of the repository owner.} diff --git a/man/get_collaborator_list.Rd b/man/get_collaborator_list.Rd index 10a6bc3..da4dc92 100644 --- a/man/get_collaborator_list.Rd +++ b/man/get_collaborator_list.Rd @@ -4,8 +4,7 @@ \alias{get_collaborator_list} \title{List Collaborators} \usage{ -get_collaborator_list(owner, repo, affiliation = c("all", "outside", - "direct")) +get_collaborator_list(owner, repo, affiliation = c("all", "outside", "direct")) } \arguments{ \item{owner}{Name of the repository owner.} diff --git a/man/get_org_members_list.Rd b/man/get_org_members_list.Rd index 0cd7722..2ec6a00 100644 --- a/man/get_org_members_list.Rd +++ b/man/get_org_members_list.Rd @@ -4,8 +4,11 @@ \alias{get_org_members_list} \title{Retrieve Membership list in an Organization} \usage{ -get_org_members_list(org, filter = c("all", "2fa_disabled"), - role = c("all", "admin", "member")) +get_org_members_list( + org, + filter = c("all", "2fa_disabled"), + role = c("all", "admin", "member") +) } \arguments{ \item{org}{Name of the organization} diff --git a/man/get_org_repos_list.Rd b/man/get_org_repos_list.Rd index 2a6ea8e..1a58756 100644 --- a/man/get_org_repos_list.Rd +++ b/man/get_org_repos_list.Rd @@ -4,8 +4,10 @@ \alias{get_org_repos_list} \title{Retrieve Repositories in an Organization} \usage{ -get_org_repos_list(org, type = c("all", "public", "private", "forks", - "sources", "member")) +get_org_repos_list( + org, + type = c("all", "public", "private", "forks", "sources", "member") +) } \arguments{ \item{org}{Name of the organization} diff --git a/man/get_self_repos_list.Rd b/man/get_self_repos_list.Rd index 467f3f2..bf74b08 100644 --- a/man/get_self_repos_list.Rd +++ b/man/get_self_repos_list.Rd @@ -4,9 +4,13 @@ \alias{get_self_repos_list} \title{List Self Repos} \usage{ -get_self_repos_list(visibility = "all", - affiliation = "owner,collaborator,organization_member", type = "all", - sort = "full_name", direction = "desc") +get_self_repos_list( + visibility = "all", + affiliation = "owner,collaborator,organization_member", + type = "all", + sort = "full_name", + direction = "desc" +) } \arguments{ \item{visibility}{Can be one of `"all"`, `"public"`, or `"private"`. Default: `"all"`} diff --git a/man/get_user_repos_list.Rd b/man/get_user_repos_list.Rd index 12893f6..f0b03e0 100644 --- a/man/get_user_repos_list.Rd +++ b/man/get_user_repos_list.Rd @@ -4,8 +4,12 @@ \alias{get_user_repos_list} \title{List User Repositories} \usage{ -get_user_repos_list(username, type = "owner", sort = "full_name", - direction = "desc") +get_user_repos_list( + username, + type = "owner", + sort = "full_name", + direction = "desc" +) } \arguments{ \item{username}{Name of the GitHub user to retrieve repos for.} diff --git a/man/ghapi3-package.Rd b/man/ghapi3-package.Rd index e2427ce..fc43ca4 100644 --- a/man/ghapi3-package.Rd +++ b/man/ghapi3-package.Rd @@ -6,7 +6,8 @@ \alias{ghapi3-package} \title{ghapi3: GitHub v3 API Implementation} \description{ -Provides access to GitHub API v3.0 using the gh package backend. +Provides access to select GitHub API v3.0 endpoints using + the 'gh' package backend. } \details{ This package requires users have access to a GitHub Personal Access Token (PAT) @@ -14,13 +15,13 @@ This package requires users have access to a GitHub Personal Access Token (PAT) \seealso{ Useful links: \itemize{ - \item \url{https://github.com/coatless/ghapi} - \item Report bugs at \url{https://github.com/coatless/ghapi/issues} + \item \url{https://github.com/coatless/ghapi3} + \item Report bugs at \url{https://github.com/coatless/ghapi3/issues} } } \author{ -\strong{Maintainer}: James Balamuta \email{balamut2@illinois.edu} [copyright holder] +\strong{Maintainer}: James Balamuta \email{balamut2@illinois.edu} (\href{https://orcid.org/0000-0003-2826-8458}{ORCID}) [copyright holder] Other contributors: \itemize{ @@ -28,3 +29,4 @@ Other contributors: } } +\keyword{internal} diff --git a/man/org-invites.Rd b/man/org-invites.Rd index a378ae4..9e995ca 100644 --- a/man/org-invites.Rd +++ b/man/org-invites.Rd @@ -5,11 +5,19 @@ \alias{create_org_invitation_email} \title{Create Organization Invitations} \usage{ -create_org_invitation_ghname(org, invitee_id, role = c("admin", - "direct_member", "billing_manager"), team_ids = NULL) - -create_org_invitation_email(org, email, role = c("admin", - "direct_member", "billing_manager"), team_ids = NULL) +create_org_invitation_ghname( + org, + invitee_id, + role = c("admin", "direct_member", "billing_manager"), + team_ids = NULL +) + +create_org_invitation_email( + org, + email, + role = c("admin", "direct_member", "billing_manager"), + team_ids = NULL +) } \arguments{ \item{org}{Name of the organization} diff --git a/man/repo-creation.Rd b/man/repo-creation.Rd index 20c7506..6d56f9c 100644 --- a/man/repo-creation.Rd +++ b/man/repo-creation.Rd @@ -5,21 +5,39 @@ \alias{create_org_repo} \title{Creates a Repository in an Organization or User Space} \usage{ -create_user_repo(name, +create_user_repo( + name, description = "This repository has been created with ghapi3", - homepage = "https://github.com/coatless/ghapi3", private = FALSE, - has_issues = TRUE, has_projects = TRUE, has_wiki = TRUE, - auto_init = FALSE, gitignore_template = "R", - license_template = "gpl-3.0", allow_squash_merge = TRUE, - allow_merge_commit = TRUE, allow_rebase_merge = TRUE) - -create_org_repo(org, name, + homepage = "https://github.com/coatless/ghapi3", + private = FALSE, + has_issues = TRUE, + has_projects = TRUE, + has_wiki = TRUE, + auto_init = FALSE, + gitignore_template = "R", + license_template = "gpl-3.0", + allow_squash_merge = TRUE, + allow_merge_commit = TRUE, + allow_rebase_merge = TRUE +) + +create_org_repo( + org, + name, description = "This repository has been created with ghapi3", - homepage = "https://github.com/coatless/ghapi3", private = FALSE, - has_issues = TRUE, has_projects = TRUE, has_wiki = TRUE, - team_id = NULL, auto_init = FALSE, gitignore_template = "R", - license_template = "gpl-3.0", allow_squash_merge = TRUE, - allow_merge_commit = TRUE, allow_rebase_merge = TRUE) + homepage = "https://github.com/coatless/ghapi3", + private = FALSE, + has_issues = TRUE, + has_projects = TRUE, + has_wiki = TRUE, + team_id = NULL, + auto_init = FALSE, + gitignore_template = "R", + license_template = "gpl-3.0", + allow_squash_merge = TRUE, + allow_merge_commit = TRUE, + allow_rebase_merge = TRUE +) } \arguments{ \item{name}{The name of the repository.}