alexku / blt-github-actions

Github Actions integration for Acquia BLT.
GNU General Public License v2.0
10 stars 9 forks source link

PHP Warning: call_user_func_array expects parameter to be a valid callback, class CopyDir does not have a method 'stopOnFail' in CompletionWrapper.php on line 104 #3

Open njt1982 opened 3 years ago

njt1982 commented 3 years ago
PHP Warning:  call_user_func_array() expects parameter 1 to be a valid callback, class 'Robo\Task\Filesystem\CopyDir' does not have a method 'stopOnFail' in /Users/nthompson/Sites/PROJECTNAME/vendor/consolidation/robo/src/Collection/CompletionWrapper.php on line 104

I get this on init... Not sure if its an upstream issue or not. 🤷🏻‍♂️

sarahjean commented 3 years ago

I got this as well. I assume it was supposed to copy the scripts that it references into the scripts directory but failed to do that. the default.yml file was created though. This is the command I ran and the output:

$ lando blt recipes:ci:github-actions:init

PHP Warning:  call_user_func_array() expects parameter 1 to be a valid callback, class 'Robo\Task\Filesystem\CopyDir' does not have a method 'stopOnFail' in /app/vendor/consolidation/robo/src/Collection/CompletionWrapper.php on line 104

Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'Robo\Task\Filesystem\CopyDir' does not have a method 'stopOnFail' in /app/vendor/consolidation/robo/src/Collection/CompletionWrapper.php on line 104
[Filesystem\FilesystemStack] mkdir ["/app/.github"]
A pre-configured Github Actions workflow file was copied to your repository .github folder.
patrickcate commented 1 year ago

Ran into same issue while trying to evaluate the plugin.

the default.yml file was created though

This was not the case for me.

endre-soo-TPX commented 1 year ago

For me it doesn't generate anything and the script terminates with this error

Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, class Robo\Task\Filesystem\CopyDir does not have a method "stopOnFail" in /var/www/html/vendor/consolidation/robo/src/Collection/CompletionWrapper.php:104
Stack trace:
#0 /var/www/html/vendor/consolidation/robo/src/Collection/CompletionWrapper.php(104): call_user_func_array(Array, Array)
#1 [internal function]: Robo\Collection\CompletionWrapper->__call('stopOnFail', Array)
#2 /var/www/html/vendor/consolidation/robo/src/Collection/CollectionBuilder.php(468): call_user_func_array(Array, Array)
#3 /var/www/html/vendor/alexku/blt-github-actions/src/Blt/Plugin/Commands/GithubActionsCommands.php(27): Robo\Collection\CollectionBuilder->__call('stopOnFail', Array)
#4 [internal function]: Acquia\GithubActions\Blt\Plugin\Commands\GithubActionsCommands->azureInit(Array)
#5 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#6 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#7 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#8 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(390): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#9 /var/www/html/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/html/vendor/symfony/console/Application.php(1039): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /var/www/html/vendor/acquia/blt/src/Robo/Application.php(31): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/html/vendor/symfony/console/Application.php(275): Acquia\Blt\Robo\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /var/www/html/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /var/www/html/vendor/consolidation/robo/src/Runner.php(282): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /var/www/html/vendor/acquia/blt/src/Robo/Blt.php(264): Robo\Runner->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput), Object(Acquia\Blt\Robo\Application), Array)
#16 /var/www/html/vendor/acquia/blt/bin/blt-robo-run.php(35): Acquia\Blt\Robo\Blt->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /var/www/html/vendor/acquia/blt/bin/blt-robo.php(15): require_once('/var/www/html/v...')
#18 /var/www/html/vendor/acquia/blt/bin/blt(11): require_once('/var/www/html/v...')
#19 /var/www/html/bin/blt(120): include('/var/www/html/v...')
#20 {main}
  thrown in /var/www/html/vendor/consolidation/robo/src/Collection/CompletionWrapper.php on line 104
endre-soo-TPX commented 1 year ago

I made the following change on a forked version

diff --git a/src/Blt/Plugin/Commands/GithubActionsCommands.php b/src/Blt/Plugin/Commands/GithubActionsCommands.php
index d1a7b36..a13eda2 100644
--- a/src/Blt/Plugin/Commands/GithubActionsCommands.php
+++ b/src/Blt/Plugin/Commands/GithubActionsCommands.php
@@ -24,7 +24,6 @@ class GithubActionsCommands extends BltTasks {
     $result = $this->taskFilesystemStack()
       ->mkdir($this->getConfigValue('repo.root') . '/.github')
       ->taskCopyDir([$source => $destination])
-      ->stopOnFail()
       ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
       ->run();

and it seems't working OK. I know we'd have to replace the stopOnFail method with something but the parent library got it removed.

Perhaps wrapping it into a try catch block would do the trick.

timodwhit commented 1 year ago

I am getting the same issue.

BLT 13.7.0.0
PHP 8.1.13 (cli)