if (FALSE) { # interactive()
# Create a new file
result <- file_update(
repo = "username/repository",
path = "path/to/new_file.R",
content = "# New R script\n\nprint('Hello world')",
message = "Add new script file"
)
# Check if operation was successful
if (!is.null(result)) {
# Access commit information
commit_sha <- result$commit$sha
}
# Update an existing file (requires SHA)
file_info <- file_content("username/repository", "path/to/existing_file.R")
if (!is.null(file_info)) {
result <- file_update(
repo = "username/repository",
path = "path/to/existing_file.R",
content = "# Updated content\n\nprint('Hello updated world')",
message = "Update file content",
sha = file_info$sha
)
}
}
Run the code above in your browser using DataLab