Skip to content

Conversation

@ernilambar
Copy link
Member

Update readme

@ernilambar ernilambar requested a review from a team as a code owner May 14, 2024 08:25
@ernilambar ernilambar added the scope:documentation Related to documentation label May 14, 2024
@swissspidy
Copy link
Member

FYI we have an automated workflow that does this regularly. It can also be triggered manually, see https://github.com/wp-cli/entity-command/actions/workflows/regenerate-readme.yml

Then you can trigger it manually and even approve it yourself.

@ernilambar
Copy link
Member Author

ernilambar commented May 14, 2024

@swissspidy Does that action run in cron or something? It seems only testing.yml is set to run in cron. https://github.com/wp-cli/.github/blob/main/.github/workflows/testing.yml

@ernilambar
Copy link
Member Author

I re-ran the workflow in this repo but it is not detecting the changes. https://github.com/wp-cli/entity-command/actions/runs/9076624244/job/24939743450

@swissspidy
Copy link
Member

Ah, it's triggered when pushing to the main branch, that's what it is.

It was triggered for the merge of that new command as well: https://github.com/wp-cli/entity-command/actions/runs/8949960535/job/24584816614

But you're right, it's not working anymore 🤔

Maybe it's the echo "CHANGES_DETECTED=$([[ -z $(git status --porcelain) ]] && echo "0" || echo "1")" >> $GITHUB_ENV part that's at fault?

@swissspidy
Copy link
Member

OK but it is working for wp-cli/admin-command#44? 🤔 Strange!

@swissspidy swissspidy added this to the 2.8.1 milestone May 14, 2024
@ernilambar
Copy link
Member Author

It did not work for find also but it looks like dependency issue. https://github.com/wp-cli/find-command/actions/runs/9076553729/job/24939505278

@thelovekesh
Copy link
Member

I am also looking into it. Seems like WP-CLI is not working as expected in find command package.

@swissspidy
Copy link
Member

The dependency issue should have been addressed by wp-cli/scaffold-package-command#243

@thelovekesh
Copy link
Member

@swissspidy Seems like the issue is with the nightly phar file. I run the following commands in the root of wp-cli/find-command package.

[Output]
➜  find-command git:(main) ✗ php ./wp-cli.phar scaffold package-readme --branch=main --force .                
Warning: File already exists
./README.md
Replacing

Success: Created package readme.
➜  find-command git:(main) ✗ php ./wp-cli-nightly.phar scaffold package-readme --branch=main --force .
PHP Fatal error:  Uncaught Error: Call to undefined method WP_CLI\Dispatcher\RootCommand::get_hook() in phar:///home/thelovekesh/Desktop/lpps/find-command/wp-cli-nightly.phar/vendor/wp-cli/wp-cli/php/commands/src/CLI_Command.php:42
Stack trace:
#0 phar:///home/thelovekesh/Desktop/lpps/find-command/wp-cli-nightly.phar/vendor/wp-cli/wp-cli/php/commands/src/CLI_Command.php(555): CLI_Command->command_to_array()
wp-cli/language-command#1 [internal function]: CLI_Command->cmd_dump()
wp-cli/language-command#2 /home/thelovekesh/Desktop/lpps/find-command/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100): call_user_func()
wp-cli/language-command#3 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}()
wp-cli/language-command#4 /home/thelovekesh/Desktop/lpps/find-command/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(497): call_user_func()
wp-cli/language-command#5 phar:///home/thelovekesh/Desktop/lpps/find-command/wp-cli-nightly.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(441): WP_CLI\Dispatcher\Subcommand->invoke()
wp-cli/language-command#6 phar:///home/thelovekesh/Desktop/lpps/find-command/wp-cli-nightly.phar/vendor/wp-cli/wp-cli/php/class-wp-cli.php(1390): WP_CLI\Runner->run_command()
wp-cli/language-command#7 /home/thelovekesh/.wp-cli/packages/vendor/wp-cli/scaffold-package-command/src/ScaffoldPackageCommand.php(300): WP_CLI::runcommand()
wp-cli/language-command#8 [internal function]: WP_CLI\ScaffoldPackageCommand->package_readme()
wp-cli/language-command#9 /home/thelovekesh/Desktop/lpps/find-command/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100): call_user_func()
wp-cli/language-command#10 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}()
wp-cli/language-command#11 /home/thelovekesh/Desktop/lpps/find-command/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(497): call_user_func()
wp-cli/language-command#12 phar:///home/thelovekesh/Desktop/lpps/find-command/wp-cli-nightly.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(441): WP_CLI\Dispatcher\Subcommand->invoke()
wp-cli/language-command#13 phar:///home/thelovekesh/Desktop/lpps/find-command/wp-cli-nightly.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(464): WP_CLI\Runner->run_command()
wp-cli/language-command#14 phar:///home/thelovekesh/Desktop/lpps/find-command/wp-cli-nightly.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(136): WP_CLI\Runner->run_command_and_exit()
wp-cli/language-command#15 phar:///home/thelovekesh/Desktop/lpps/find-command/wp-cli-nightly.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1229): WP_CLI\Runner->do_early_invoke()
wp-cli/language-command#16 phar:///home/thelovekesh/Desktop/lpps/find-command/wp-cli-nightly.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
wp-cli/language-command#17 phar:///home/thelovekesh/Desktop/lpps/find-command/wp-cli-nightly.phar/vendor/wp-cli/wp-cli/php/bootstrap.php(83): WP_CLI\Bootstrap\LaunchRunner->process()
wp-cli/language-command#18 phar:///home/thelovekesh/Desktop/lpps/find-command/wp-cli-nightly.phar/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap()
wp-cli/language-command#19 phar:///home/thelovekesh/Desktop/lpps/find-command/wp-cli-nightly.phar/php/boot-phar.php(20): include('...')
wp-cli/language-command#20 /home/thelovekesh/Desktop/lpps/find-command/wp-cli-nightly.phar(4): include('...')
wp-cli/language-command#21 {main}
  thrown in phar:///home/thelovekesh/Desktop/lpps/find-command/wp-cli-nightly.phar/vendor/wp-cli/wp-cli/php/commands/src/CLI_Command.php on line 42
➜  find-command git:(main) ✗ php -r '$phar = new Phar("wp-cli.phar"); $phar->extractTo("./wp-cli");'    

➜  find-command git:(main) ✗ php ./wp-cli/php/boot-phar.php scaffold package-readme --branch=main --force . 
Warning: File already exists
./README.md
Replacing

Success: Created package readme.
➜  find-command git:(main) ✗ php -r '$phar = new Phar("wp-cli-nightly.phar"); $phar->extractTo("./wp-cli-nightly");'

➜  find-command git:(main) ✗ php ./wp-cli-nightly/php/boot-phar.php scaffold package-readme --branch=main --force . 
Warning: File already exists
./README.md
Replacing

Success: Created package readme.

Initially, I donwloaded both the nightly and distributed versions of the wp-cli phars. Then, I proceeded to extract them into directories and executed the command. Interestingly, I encountered an error only with wp-cli-nightly.phar. Should we initiate the creation of a new nightly phar? or should we wait the arrival of the next one?

@swissspidy
Copy link
Member

From what I can see the nightly phar is as up-to-date as it can be.

The workflow doesn't use the phar though, does it?

Just looked at https://github.com/wp-cli/i18n-command/actions/runs/9077866771/job/24943664516 and the issue is that it installs wp-cli/wp-cli 2.10 instead of 2.11 aka dev-main.

So we'd need to bump the dependency in i18n-command.

@thelovekesh
Copy link
Member

Before that, it installed the nightly phar whose version is WP-CLI 2.11.0-alpha-1b3a27a.

 curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli-nightly.phar
 sudo mv wp-cli-nightly.phar /usr/local/bin/wp
 sudo chmod +x /usr/local/bin/wp

@thelovekesh
Copy link
Member

Your assumption can also be true as I am not sure which wp-cli binary is included when executing the phar.

@swissspidy
Copy link
Member

Hmm that's strange, WP-CLI 2.11.0-alpha-1b3a27a is the latest, which definitely includes the latest framework version as well.

So definitely something odd going on with dependencies.

I'll need to do more testing.

Meanwhile, @schlessera perhaps you have some ideas.

@swissspidy
Copy link
Member

PHP Fatal error:  Uncaught Error: Call to undefined method WP_CLI\Dispatcher\RootCommand::get_hook() in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/commands/src/CLI_Command.php:42
Stack trace:
#0 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/commands/src/CLI_Command.php(555): CLI_Command->command_to_array()
wp-cli/language-command#1 [internal function]: CLI_Command->cmd_dump()
wp-cli/language-command#2 /home/runner/work/i18n-command/i18n-command/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100): call_user_func()
wp-cli/language-command#3 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}()
wp-cli/language-command#4 /home/runner/work/i18n-command/i18n-command/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(497): call_user_func()
wp-cli/language-command#5 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(441): WP_CLI\Dispatcher\Subcommand->invoke()
wp-cli/language-command#6 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cli.php(1394): WP_CLI\Runner->run_command()
wp-cli/language-command#7 /home/runner/.wp-cli/packages/vendor/wp-cli/scaffold-package-command/src/ScaffoldPackageCommand.php(30 in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/commands/src/CLI_Command.php on line 42

So it is loading some classes from the Phar (which is the nightly and thus has 2.11), but then RootCommand is coming from i18n-command/vendor/wp-cli which is using 2.10.

@swissspidy
Copy link
Member

Discussion continues in wp-cli/wp-cli#5968

@swissspidy swissspidy merged commit c270cc9 into wp-cli:main Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope:documentation Related to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants