Skip to content

Fix gitlab ci path creation#6

Merged
VincentGuyader merged 3 commits intomainfrom
codex/trouver-et-corriger-un-bug
Jun 6, 2025
Merged

Fix gitlab ci path creation#6
VincentGuyader merged 3 commits intomainfrom
codex/trouver-et-corriger-un-bug

Conversation

@VincentGuyader
Copy link
Copy Markdown
Owner

Summary

  • ensure set_gitlab_ci() creates destination directory

Testing

  • devtools::test() (fails: packages attachment, dockerfiler and yesno not installed)

https://chatgpt.com/codex/tasks/task_e_6842de439bd88328a3969470b2c15e07

@VincentGuyader VincentGuyader requested a review from Copilot June 6, 2025 12:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances set_gitlab_ci() by ensuring the destination directory is created if it doesn't already exist before copying the .gitlab-ci.yml file.

  • Adds a check for dir.exists(path) and creates the directory with dir.create()
  • Emits a success alert when a new directory is created
Comments suppressed due to low confidence (2)

R/set_gitlab_ci.R:32

  • Add a unit test to verify that set_gitlab_ci() creates the destination directory when it does not exist, ensuring this new behavior is covered.
# Create the destination directory if it doesn't exist

R/set_gitlab_ci.R:29

  • Update the function documentation to mention that it now automatically creates the target directory if it does not already exist.
set_gitlab_ci <- function(path) {

Comment thread R/set_gitlab_ci.R Outdated
Comment thread R/set_gitlab_ci.R Outdated

# Create the destination directory if it doesn't exist
if (!dir.exists(path)) {
dir.create(path, recursive = TRUE, showWarnings = FALSE)
Copy link

Copilot AI Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suppressing warnings with showWarnings = FALSE may hide important errors; consider allowing warnings or checking the function result to detect failures.

Suggested change
dir.create(path, recursive = TRUE, showWarnings = FALSE)
success <- dir.create(path, recursive = TRUE)
if (!isTRUE(success)) {
cli::cli_alert_danger("Failed to create directory: {path}")
stop("Directory creation failed. Please check the path and permissions.")
}

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@VincentGuyader VincentGuyader merged commit f58ab38 into main Jun 6, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants