Skip to content

Commit

Permalink
Merge pull request #180 from dgaidula/v1-updates
Browse files Browse the repository at this point in the history
V1 updates
  • Loading branch information
Oliver Stark authored Oct 27, 2023
2 parents 74a3d13 + e34c38c commit 7ca7ccc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Actions/CodeUpAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class CodeUpAction extends StageAwareBaseAction
*/
protected $localVolume;

public $commitMessage = '';

public function __construct(
string $id,
Commands $controller,
Expand Down Expand Up @@ -91,7 +93,10 @@ public function run(?string $stage = null)
if ($status = $git->getWorkingCopy()->getStatus()) {
// Changed files
$this->noteBlock('Uncommitted changes:' . PHP_EOL . $status);
$defaultMessage = $this->interactive ? null : 'init Craft';

$defaultMessage = $this->commitMessage ? $this->commitMessage : "Push latest to $upstream";
//interactive must be false for custom commit message
$defaultMessage = $this->interactive ? null : $defaultMessage;

if (! $msg = $this->ask(
'Enter a commit message, or leave it empty to abort the commit',
Expand All @@ -115,9 +120,9 @@ public function run(?string $stage = null)
}

try {
$this->section("git push ($msg)");
$this->section("git push ($msg) to $upstream from $branch to master");
$git->getWorkingCopy()->getWrapper()->streamOutput();
$git->push($upstream, 'master');
$git->push($upstream, "$branch:master");
} catch (GitException $exception) {
$lines = count(explode(PHP_EOL, $exception->getMessage()));
$this->output->write(str_repeat("\x1B[1A\x1B[2K", $lines));
Expand Down
1 change: 1 addition & 0 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ private function registerConsoleCommands(): void
'a' => 'app',
'e' => 'env',
'f' => 'force',
'm' => 'commitMessage',
];

$group = (new ActionGroup('copy', 'Copy Craft between environments.'))
Expand Down

0 comments on commit 7ca7ccc

Please sign in to comment.