Set of functions to integrate archivist-package with GitHub API https://developer.github.com/v3/.
To start working with archivist.github one should run authoriseGitHub to create an
OAuth token which is required by every function in this package.
It is possible to create new GitHub repository with an empty archivist-like Repository with createGitHubRepo function.
archive stores artifacts in the Local
Repository and automatically pushes archived artifacts to the GitHub
Repository with which the Local
Repository is synchronized.
cloneGitHubRepo clones GitHub Repository into the local directory.
deleteGitHubRepo can delete whole GitHub-Repository or only archivist-like Repository stored on a GitHub-Repository.
pushGitHubRepo and pullGitHubRepo synchronize Local and GitHub (remote) Repository.
To use this set of functionalities, one firstly has to authorize himselft to the GitHub API.
It can be done by creating https://github.com/settings/developers
(register new application). If you do not know what should be included as
callback url, you may
http://localhost:1410 for testing purposes.
When application is created, one will have to copy its
Client ID and
Client Secret and authorize his github user with this application by running those commands:
myapp <- oauth_app("github", key = Client_ID, secret = Client_Secret),
github_token <- oauth2.0_token(oauth_endpoints("github"), myapp, scope = "public_repo").
scope limits can be found here
Basically, this is how you grant an access to your application and give permissions.
With such a token one is authorized and can work with GitHub API and archivist
functions devoted to GitHub integration.
To perform GitHub integration operations such as
a user has to pass his GitHub user name (
user.name parameter), user email (
parameter) and user password (
user.password parameter). Those parameters can be set globbaly
Note that global configuration of the
git config is used for initial commit.
One can later specify local configuration for the repository with config, e.g
config(repoName, user.name = "Alice", user.email = "mail_at_gmail.com").
Bug reports and feature requests can be sent to https://github.com/MarcinKosinski/archivist.github/issues
Marcin Kosinski, [email protected]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
## Not run: authoriseGitHub(ClientID, ClientSecret) -> github_token # authoriseGitHub also does: aoptions("github_token", github_token) aoptions("user", user.name) aoptions("password", user.password) ## here github_token is used createGitHubRepo("Museum") createGitHubRepo("Museum-Extras", response = TRUE) createGitHubRepo("Gallery", readme = NULL) createGitHubRepo("Landfill", repoDescription = "My models and stuff") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.