-
Notifications
You must be signed in to change notification settings - Fork 22
Error when creating archive with GH actions using dev-main branch #63
Description
Bug Report
- Yes, I reviewed the contribution guidelines.
- Yes, more specifically, I reviewed the guidelines on how to write clear bug reports.
Describe the current, buggy behavior
I run the following command in GH Actions:
wp dist-archive my-fancy-plugin $zip_name
It's been running without error for quite some time, but as of yesterday, I get this error:
PHP Warning: Undefined array key "plugin-dirname" in /home/runner/.wp-cli/packages/vendor/wp-cli/dist-archive-command/src/Dist_Archive_Command.php on line 164
Describe how other contributors can replicate this bug
This is the chain of commands I'm running:
run: |
echo "Installing WP-CLI dist-archive command..."
wp package install wp-cli/dist-archive-command
echo "Creating zip..."
safe_branch_name=$(echo ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}|sed 's/\//_/g')
zip_name=my-fancy-plugin-$safe_branch_name.zip
cd ..
wp dist-archive my-fancy-plugin $zip_name
The runner apparently installs dev-main (f5b532c) by default. Here's the stack trace:
PHP Warning: Undefined array key "plugin-dirname" in /home/runner/.wp-cli/packages/vendor/wp-cli/dist-archive-command/src/Dist_Archive_Command.php on line 164
PHP Stack trace:
PHP 1. {main}() /usr/local/bin/wp:0
PHP 2. include() /usr/local/bin/wp:4
PHP 3. include() phar:///usr/local/bin/wp/php/boot-phar.php:11
PHP 4. WP_CLI\bootstrap() phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php:27
PHP 5. WP_CLI\Bootstrap\LaunchRunner->process($state = class WP_CLI\Bootstrap\BootstrapState { private $state = ['context_manager' => class WP_CLI\ContextManager { ... }] }) phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php:78
PHP 6. WP_CLI\Runner->start() phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php:28
PHP 7. WP_CLI\Runner->do_early_invoke($when = 'before_wp_load') phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:1170
PHP 8. WP_CLI\Runner->run_command_and_exit($help_exit_warning = *uninitialized*) phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:125
PHP 9. WP_CLI\Runner->run_command($args = [0 => 'dist-archive', 1 => 'my-fancy-plugin', 2 => 'my-fancy-plugin-fix_2372_hash_api_creds.zip'], $assoc_args = [], $options = *uninitialized*) phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:440
PHP 10. WP_CLI\Dispatcher\Subcommand->invoke($args = [0 => 'my-fancy-plugin', 1 => 'my-fancy-plugin-fix_2372_hash_api_creds.zip'], $assoc_args = [], $extra_args = []) phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:417
PHP 11. call_user_func:{phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:[49](https://github.com/MyOrg/my-fancy-plugin/runs/9185193513?check_suite_focus=true#step:16:50)1}($callback = class Closure { virtual $closure = "$this->WP_CLI\Dispatcher\{closure}", public $static = ['callable' => [...]]; public $parameter = ['$args' => '<required>', '$assoc_args' => '<required>'] }, ...$args = variadic(['format' => 'zip'])) phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:491
PHP 12. WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure:phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:97-104}($args = [0 => 'my-fancy-plugin', 1 => 'my-fancy-plugin-fix_2372_hash_api_creds.zip'], $assoc_args = ['format' => 'zip']) phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:491
PHP 13. call_user_func:{phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:100}($callback = [0 => class Dist_Archive_Command { }, 1 => '__invoke'], ...$args = variadic(['format' => 'zip'])) phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:100
PHP 14. Dist_Archive_Command->__invoke($args = [0 => 'my-fancy-plugin', 1 => 'my-fancy-plugin-fix_2372_hash_api_creds.zip'], $assoc_args = ['format' => 'zip']) phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:100
If I instead install the following, the zip archive is created with no issues:
wp package install wp-cli/dist-archive-command:@stable
Describe what you would expect as the correct outcome
The zip archive should be created with no errors.
Let us know what environment you are running this on
Unsure how to easily get this on GH Actions, but here's the runner environment:
Operating System
Ubuntu
20.04.4
LTS
Runner Image
Image: ubuntu-20.04
Version: 20220828.1
Included Software: https://github.com/actions/runner-images/blob/ubuntu20/20220828.1/images/linux/Ubuntu2004-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu20%2F20220828.1
Runner Image Provisioner
1.0.0.0-main-20220825-1