Skip to content

Commit

Permalink
Merge pull request #161 from fortrabbit/feature/custom-default-commit…
Browse files Browse the repository at this point in the history
…-message

Allow customising commit message made in code/up command
  • Loading branch information
Oliver Stark authored Apr 17, 2023
2 parents b8a9ada + 7b742df commit 6c893dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Actions/CodeUpAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

class CodeUpAction extends StageAwareBaseAction
{
public string $commitMessage = "init Craft";

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

$commitMessage = $this->commitMessage;
if ($this->commitMessage == "1") {
$commitMessage = "init Craft";
}

$defaultMessage = $this->interactive ? null : $commitMessage;

if (! $msg = $this->ask(
'Enter a commit message, or leave it empty to abort the commit',
Expand Down
1 change: 1 addition & 0 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,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 6c893dd

Please sign in to comment.