Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ If you prefer manual install, you need:

If you prefer Vagrant, you only need to install
[Vagrant](https://www.vagrantup.com/downloads.html) and [VirtualBox](https://www.virtualbox.org/wiki/Downloads),
because our Vagrant environment already contains Ubuntu, PHP and Composer.
because our Vagrant environment already contains Ubuntu, PHP, and Composer.
See our Vagrant [documentation](vagrant/README.md) for details.

### Docker
Expand Down Expand Up @@ -66,7 +66,7 @@ Configuration
-------------

To customize the configuration of **yii-dev-tool**, create your local configuration `packages.local.php`
using file `packages.local.php.example` as example. In this file you will find examples of all available
using file `packages.local.php.example` as example. In this file, you will find examples of all available
configuration options.

Some commands such as `github/protect-branch`, `github/settings`, `release/make` require
Expand Down Expand Up @@ -96,12 +96,12 @@ Go to the page of each repository and click the "Fork" button:
* [yiisoft/view](https://github.com/yiisoft/view)
* [yiisoft/i18n](https://github.com/yiisoft/i18n)

Suppose my nickname on Github is "samdark". Then I will get three forks:
Suppose my nickname on GitHub is `samdark`. Then I will get three forks:
* samdark/demo
* samdark/view
* samdark/i18n

For your nickname you will get other fork names.
For your nickname, you will get other fork names.

### Step 2: install yii-dev-tool

Expand Down Expand Up @@ -144,7 +144,8 @@ See [example](packages.local.php.example).

### Step 4: install packages

In order to work with Github via SSH, you have to [add](https://docs.github.com/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account) your public SSH key to Github account. Add key if you have not done it before.
To work with GitHub via SSH, you have to [add](https://docs.github.com/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account) your public SSH key to GitHub account.
Add key if you have not done it before.

Now install the packages:

Expand Down Expand Up @@ -213,7 +214,7 @@ Go to the pages of the original repositories and create a PR in each:

### Final notes

That's all. We developed new functionality and submitted it for review 🙂 Of course, the steps will be
That's all. We developed new functionality and submitted it for review, 🙂 Of course, the steps will be
slightly different for different tasks and configurations.

Remember that **yii-dev-tool** contains many other commands:
Expand Down
53 changes: 53 additions & 0 deletions src/App/Command/ActCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

declare(strict_types=1);

namespace Yiisoft\YiiDevTool\App\Command;

use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Process\Process;
use Yiisoft\YiiDevTool\App\Component\Console\PackageCommand;
use Yiisoft\YiiDevTool\App\Component\Package\Package;

#[AsCommand(
name: 'act',
description: 'Run GitHub action'
)]
final class ActCommand extends PackageCommand
{
protected function processPackage(Package $package): void
{
$io = $this->getIO();
$io->preparePackageHeader($package, 'Running actions on {package}');

$actBinary = dirname(__DIR__, 3) . '/bin/act';

Copy link

Copilot AI Jun 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validate that the act binary exists at this path and is executable before invoking the process, so you can provide a clear and immediate error if it's missing or not executable.

Suggested change
if (!file_exists($actBinary) || !is_executable($actBinary)) {
$io
->important()
->error(<<<ERROR
$actBinary does not exist or is not executable. Ensure the binary is installed and has the correct permissions.
Use the following to install it:
curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
ERROR);
exit(1);
}
Copilot uses AI. Check for mistakes.
$process = new Process([
$actBinary,
], $package->getPath());
$process->setTimeout(20);
$process->run();

if (!$process->isSuccessful() && $this->actIsNotInstalled($process)) {
$io
->important()
->error(<<<ERROR
$actBinary is not installed. Use the following to install it:
curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
ERROR);

return Command::FAILURE;
}

$output = $process->getErrorOutput();
$this->registerPackageError($package, $output, 'Output:');
$io
->important()
->info($process->getOutput() . $output);
}

private function actIsNotInstalled(Process $process): bool
{
return str_contains($process->getErrorOutput(), 'act: not found');
}
}
2 changes: 2 additions & 0 deletions src/App/YiiDevToolApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
use Yiisoft\YiiDevTool\App\Command\ActCommand;
use Yiisoft\YiiDevTool\App\Command\AddChangelogCommand;
use Yiisoft\YiiDevTool\App\Command\Composer\ComposerFixDependenciesCommand;
use Yiisoft\YiiDevTool\App\Command\Composer\UpdateCommand as ComposerUpdateCommand;
Expand Down Expand Up @@ -118,6 +119,7 @@ protected function getDefaultCommands(): array
new AddChangelogCommand(),
new SwitchCommand(),
new IdeCommand(),
new ActCommand(),
];
}

Expand Down
Loading