onefile: Upload, delete a file to a GitLab repository

gl_push_fileR Documentation

Upload, delete a file to a GitLab repository

Description

If the file already exists, it is updated/overwritten by default

Usage

gl_push_file(
  project,
  file_path,
  content,
  commit_message,
  branch = get_main(),
  overwrite = TRUE,
  ...
)

gl_delete_file(project, file_path, commit_message, branch = get_main(), ...)

Arguments

project

Project name or id

file_path

path where to store file in gl_repository. If in subdirectory, the parent directory should exist.

content

Character of length 1. File content (text)

commit_message

Message to use for commit with new/updated file

branch

name of branch where to append newly generated commit with new/updated file

overwrite

whether to overwrite files that already exist

...

passed on to gitlab()

Value

returns a tibble with changed branch and path (0 rows if nothing was changed, since overwrite is FALSE)

Examples

## Not run: 
# Create fake dataset
tmpfile <- tempfile(fileext = ".csv")
write.csv(mtcars, file = tmpfile)
# Push content to repository with a commit
gl_push_file(
  project = <<your-project-id>>,
  file_path = "test_data.csv",
  content = paste(readLines(tmpfile), collapse = "\n"),
  commit_message = "New test data")

## End(Not run)

gitlabr documentation built on Sept. 13, 2022, 5:06 p.m.