Skip to content

Commit 1c5ed09

Browse files
author
nejc
committed
feat: enhance PR command dry-run output with repository info
- Add repository information section showing local and upstream URLs - Display clear step-by-step process explanation in dry-run mode - Show what will happen before executing commands - Improve final dry-run completion message with helpful tip - Better user experience and transparency - Consistent with enhanced check command output Enhanced dry-run now shows: - Repository information (local vs upstream) - Step-by-step process explanation - Clear indication that no changes were made - Helpful tip to run without --dry-run to execute - Better visual organization and readability
1 parent 2abe9ea commit 1c5ed09

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

src/Console/Commands/UpstreamPrCommand.php

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,26 @@ public function handle(): int
107107
};
108108

109109
$this->info('🚀 Creating pull request for upstream sync...');
110+
111+
// Show repository information
112+
$this->showRepositoryInfo($git, $upstreamUrl);
113+
110114
$this->line("📝 PR Branch: <info>$prBranch</info>");
111115
$this->line("🎯 Target Branch: <info>$localBranch</info>");
112116
$this->line("📋 PR Title: <info>$prTitle</info>");
117+
118+
if ($dry) {
119+
$this->newLine();
120+
$this->line('🔍 <comment>What will happen:</comment>');
121+
$this->line(' 1. 📡 Ensure upstream remote is configured');
122+
$this->line(' 2. 📥 Fetch latest changes from upstream');
123+
$this->line(' 3. 🌿 Create new PR branch from current branch');
124+
$this->line(' 4. 🔀 Merge upstream changes into PR branch');
125+
$this->line(' 5. 📤 Push PR branch to origin');
126+
$this->line(' 6. 🎯 Create GitHub pull request');
127+
$this->newLine();
128+
}
129+
113130
$this->newLine();
114131

115132
// Ensure remote exists
@@ -165,7 +182,13 @@ public function handle(): int
165182
$this->createGitHubPr($cfg, $prBranch, $localBranch, $prTitle, $prBody, $upstreamUrl);
166183
}
167184

168-
$this->info($dry ? 'Dry run complete.' : 'Pull request created successfully!');
185+
if ($dry) {
186+
$this->newLine();
187+
$this->info('✅ Dry run complete - no changes were made.');
188+
$this->line('💡 Run without <comment>--dry-run</comment> to execute the pull request creation.');
189+
} else {
190+
$this->info('✅ Pull request created successfully!');
191+
}
169192

170193
return self::SUCCESS;
171194
}
@@ -179,6 +202,25 @@ private function displayLogo(): void
179202
$this->line('');
180203
}
181204

205+
private function showRepositoryInfo(VersionControl $git, string $upstreamUrl): void
206+
{
207+
try {
208+
// Get local repository URL
209+
$localUrl = $git->run(['remote', 'get-url', 'origin'], throw: false);
210+
if (!$localUrl) {
211+
$localUrl = 'Local repository (no origin remote)';
212+
}
213+
214+
$this->line('🏠 <comment>Repository Information:</comment>');
215+
$this->line(" Local: <info>$localUrl</info>");
216+
$this->line(" Upstream: <info>$upstreamUrl</info>");
217+
$this->newLine();
218+
219+
} catch (Throwable) {
220+
// If we can't get repository info, just continue silently
221+
}
222+
}
223+
182224
private function generatePrBranchName(array $cfg): string
183225
{
184226
$customBranch = $this->option('pr-branch');

0 commit comments

Comments
 (0)