This function deploys a local file to multiple GitHub repositories. It can create new files or update existing ones, and provides detailed status reporting for each operation.
Usage
file_deploy(
source_file,
target_path,
repos,
commit_message = NULL,
branch = NULL,
create_if_missing = TRUE,
dry_run = FALSE,
quiet = FALSE
)
Arguments
- source_file
Character string specifying the local file path to deploy
- target_path
Character string specifying the path in the repositories where the file should be placed
- repos
Data frame of repositories as returned by
repos()
function, with at least afull_name
column- commit_message
Character string with the commit message. Default automatically generates a message.
- branch
Character string specifying the branch name. Default is NULL (uses default branch).
- create_if_missing
Logical indicating whether to create the file if it doesn't exist. Default is TRUE.
- dry_run
Logical indicating whether to only simulate the changes without making actual commits. Default is FALSE.
- quiet
Logical; if TRUE, suppresses progress and status messages. Default is FALSE.
Value
Returns a data.frame
with class "file_deploy_result"
containing the following columns:
- repository
Character, the full repository name (owner/repo)
- status
Character, indicating the operation result with one of these values: "created", "updated", "unchanged", "skipped", "error", "would_create", "would_update"
- message
Character, a description of the action taken or error encountered
See also
print.file_deploy_result()
for a formatted summary of deployment results.
Examples
if (FALSE) { # interactive()
# Get list of repositories
repositories <- repos("my-organization")
# Deploy a workflow file to all repositories
results <- file_deploy(
source_file = "local/path/to/workflow.yml",
target_path = ".github/workflows/ci.yml",
repos = repositories
)
# Filter to see only successfully updated repositories
updated <- results[results$status == "updated", ]
# Check for any errors
errors <- results[results$status == "error", ]
}