View source: R/use_github_file.R
use_github_file | R Documentation |
Gets the content of a file from GitHub, from any repo the user can read, and writes it into the active project. This function wraps an endpoint of the GitHub API which supports specifying a target reference (i.e. branch, tag, or commit) and which follows symlinks.
use_github_file(
repo_spec,
path = NULL,
save_as = NULL,
ref = NULL,
ignore = FALSE,
open = FALSE,
overwrite = FALSE,
host = NULL
)
repo_spec |
A string identifying the GitHub repo or, alternatively, a GitHub file URL. Acceptable forms:
In the case of a URL, the |
path |
Path of file to copy, relative to the GitHub repo it lives in.
This is extracted from |
save_as |
Path of file to create, relative to root of active project.
Defaults to the last part of |
ref |
The name of a branch, tag, or commit. By default, the file at
|
ignore |
Should the newly created file be added to |
open |
Open the newly created file for editing? Happens in RStudio, if
applicable, or via |
overwrite |
Force overwrite of existing file? |
host |
GitHub host to target, passed to the For a hypothetical GitHub Enterprise instance, either "https://github.acme.com/api/v3" or "https://github.acme.com" is acceptable. |
A logical indicator of whether a file was written, invisibly.
## Not run:
use_github_file(
"https://github.com/r-lib/actions/blob/v2/examples/check-standard.yaml"
)
use_github_file(
"r-lib/actions",
path = "examples/check-standard.yaml",
ref = "v2",
save_as = ".github/workflows/R-CMD-check.yaml"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.