Learn R Programming

ghee

Easily Interact with 'GitHub' through R


{ghee} is a user-friendly wrapper for the {gh} package that provides client access to GitHub's REST API for common tasks such as creating issues and inviting collaborators.

Table of contents


Installation

You can install the development version of {ghee} from GitHub and load it as follows:

# Install the development version from GitHub
remotes::install_github("jdtrat/ghee")

# Load package
library(ghee)

Getting Started

{ghee} is not meant to be an exhaustive package, though I do hope it will help you interact with GitHub easier. By design, all functions begin with the prefix gh_, followed by categories of actions such as collab and issue. This allows you to take advantage of RStudio's auto-completion feature and quickly achieve your programming goals. Below are currently supported functions.

Repositories

{ghee} provides the following functions for interacting with GitHub repositories.

FunctionDescriptionExample Use
gh_repos_create()Create a new GitHub repository.gh_repos_create(path = "jdtrat/ghee_test", private = TRUE))
gh_repos_delete()Delete an existing GitHub repository. Use with caution.gh_repos_delete(path = "jdtrat/ghee_test")
gh_repos_mutate()Mutate (alter) a repository's features. Potential changes include the repository's name, privacy settings, and more.gh_repos_mutate(path = "jdtrat/ghee_test", name = "ghee_testing", private = FALSE)
gh_repos_list()List a user's GitHub repositories.gh_repos_list(user = "jdtrat")

Issues

{ghee} provides the following functions for dealing with GitHub issues.

FunctionDescriptionExample Use
gh_issue_new()Create a new issue for a GitHub repository.gh_issue_new(path = "jdtrat/ghee", title = "README Demo", body = "{ghee} is great!")
gh_issue_comment()Comment on an existing issue for a GitHub repository.gh_issue_comment(path = "jdtrat/ghee", issue_number = 1, body = "Commenting from the README")
gh_issue_assign()Assign yourself, or others, to an existing issue for a GitHub repository.gh_issue_assign(path = "jdtrat/ghee", issue_number = 1, collaborator = "jdtrat")
gh_issue_mention()Check to see if a person was mentioned in any issues of a GitHub repository.gh_issue_mention(path = "jdtrat/ghee", collaborator = "jdtrat")
gh_issue_list()List existing issues for a GitHub repository.gh_issue_list("jdtrat/ghee")

Collaboration

{ghee} provides the following functions for collaborating via GitHub.

FunctionDescriptionExample Use
gh_collab_check()Check to see if someone is a collaborator on a GitHub repository.gh_collab_check(path = "jdtrat/ghee", collaborator = "hadley")
gh_collab_invite()Invite someone to collaborate on a GitHub repository.gh_collab_invite(path = "jdtrat/ghee", collaborator = "hadley")
gh_collab_pending()List the pending invites for a GitHub repository.gh_collab_pending(path = "jdtrat/ghee")
gh_collab_uninvite()Uninvite someone whose invite to collaborate on a GitHub repository is pending.gh_collab_uninvite(path = "jdtrat/ghee", collaborator = "mean-person")
gh_collab_remove()Remove an existing collaborator from a GitHub repository.gh_collab_remove(path = "jdtrat/ghee", collaborator = "mean-person")

Further Reading

If you are looking for a more in-depth explanation of these functions, I encourage you to check out my blog post introducing {ghee}.

Feedback

If you want to see a feature, or report a bug, please file an issue or open a pull-request! As this package is just getting off the ground, we welcome all feedback and contributions. See our contribution guidelines for more details on getting involved!

Code of Conduct

Please note that the ghee project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Copy Link

Version

Install

install.packages('ghee')

Monthly Downloads

8

Version

0.1.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Jonathan Trattner

Last Published

March 11th, 2021

Functions in ghee (0.1.0)

gh_collab_uninvite

Uninvite a collaborator to a GitHub repo
gh_repos_create

Create a new repository
gh_issue_new

Create an issue on a github repo
gh_issue_mention

Check to see if a person was mentioned in a GitHub issue
gh_issue_list

List issues for a GitHub Repo
gh_repos_list

List a user's github repository
gh_repos_mutate

Change repository features
gh_repos_delete

Delete a GitHub repository
gh_repos_delete_internal

Actually delete repo
gh_issue_comment

Comment on a GitHub issue
gh_issue_assign

Assign people to a GitHub issue
check_path

Check github path
gh_collab_list

List current collaborators for a GitHub repo
gh_collab_pending

List pending invitations for a repo
gh_collab_remove

Remove a collaborator from a repository
gh_collab_invite

Invite a collaborator to a GitHub repo
gh_collab_check

Check if a user is a collaborator
gh_check_assignable

Check that a person can be assigned to an issue