Skip to content

Commit

Permalink
dry-run
Browse files Browse the repository at this point in the history
  • Loading branch information
Listener430 committed Dec 26, 2024
1 parent a8e0f29 commit 22f6314
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions internal/exec/vendor_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,19 +373,23 @@ func ExecuteAtmosVendorInternal(

// Handle GitHub source
if isGitHubSource {
u.LogDebug(atmosConfig, fmt.Sprintf("Fetching GitHub source: %s", uri))
fileContents, err := u.DownloadFileFromGitHub(uri)
if err != nil {
return fmt.Errorf("failed to download GitHub file: %w", err)
}
// Save the downloaded file to the existing tempDir
tempGitHubFile := filepath.Join(tempDir, filepath.Base(uri))
err = os.WriteFile(tempGitHubFile, fileContents, os.ModePerm)
if err != nil {
return fmt.Errorf("failed to save GitHub file to temp location: %w", err)
if dryRun {
u.LogInfo(atmosConfig, fmt.Sprintf("Dry run: Fetching GitHub source: %s", uri))
} else {
u.LogDebug(atmosConfig, fmt.Sprintf("Fetching GitHub source: %s", uri))
fileContents, err := u.DownloadFileFromGitHub(uri)
if err != nil {
return fmt.Errorf("failed to download GitHub file: %w", err)
}
// Save the downloaded file to the existing tempDir
tempGitHubFile := filepath.Join(tempDir, filepath.Base(uri))
err = os.WriteFile(tempGitHubFile, fileContents, os.ModePerm)
if err != nil {
return fmt.Errorf("failed to save GitHub file to temp location: %w", err)
}
// Update the URI to point to the saved file in the temp directory
uri = tempGitHubFile
}
// Update the URI to point to the saved file in the temp directory
uri = tempGitHubFile
}

// Determine package type
Expand Down

0 comments on commit 22f6314

Please sign in to comment.