Description Usage Arguments Value Examples
These functions writes files to a repository by creating a new commit on the
specified branch. write_github_file()
writes the content
to a text file,
using readr::write_file()
; write_github_lines()
writes to a text file,
using readr::write_lines()
and write_github_csv()
writes a CSV file,
using readr::write_csv()
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | write_github_file(content, path, branch, message, repo, author, committer, ...)
write_github_lines(
content,
path,
branch,
message,
repo,
author,
committer,
...
)
write_github_csv(content, path, branch, message, repo, author, committer, ...)
|
content |
(character or data.frame) The content of the file. |
path |
(string) The path to create the file at, within the repository. |
branch |
(string) The name of the branch to make the new commit on. |
message |
(string) The commit message. |
repo |
(string) The repository specified in the format: |
author |
(list, optional) A the name and email address of the user who wrote the changes in the commit. |
committer |
(list, optional) A the name and email address of the user who created the commit. |
... |
Parameters passed to |
write_github_file()
, write_github_lines()
and
write_github_csv()
return a list of the commit properties.
Commit Properties:
sha: The commit SHA.
message: The commit message.
author_name: The author's name.
author_email: The author's email address.
committer_name: The committer's name.
committer_email: The committer's email address.
tree_sha: The SHA of the file tree.
parent_sha: The commit SHA of the parent(s).
date: The date the commit was made.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## Not run:
write_github_file(
content = "# This is a new file\\n\\n Created by githapi",
path = "new-file.md",
branch = "main",
message = "Created a new file with write_github_file()",
repo = "ChadGoymer/githapi"
)
write_github_lines(
content = c("# This is a new file", "", "Created by githapi"),
path = "new-file.md",
branch = "main",
message = "Created a new file with write_github_lines()",
repo = "ChadGoymer/githapi"
)
write_github_csv(
content = tibble(letters = LETTERS, numbers = 1:26),
path = "new-file.md",
branch = "main",
message = "Updated an existing file with write_github_csv()",
repo = "ChadGoymer/githapi"
)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.