diff --git a/Dockerfile b/Dockerfile index 602c64a..0e3bc2d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,8 @@ RUN chown -R php:php /usr/bin/app COPY . /usr/bin/app WORKDIR /usr/bin/app +ENV GITHUB_WORKSPACE=/usr/bin/app + RUN composer install VOLUME ["/usr/bin/app"] diff --git a/README.md b/README.md index b61c4d5..dcc601c 100644 --- a/README.md +++ b/README.md @@ -55,15 +55,15 @@ docker build . --build-arg=PHP_VERSION=8.3 -t=composer-package-action initialization ```shell -docker run --rm -e GITHUB_WORKSPACE=/usr/bin/app -v .:/usr/bin/app composer-package-action composer install +docker run --rm -v .:/usr/bin/app composer-package-action composer install ``` running ```shell -docker run --rm -e GITHUB_WORKSPACE=/usr/bin/app -v .:/usr/bin/app composer-package-action php app.php +docker run --rm -v .:/usr/bin/app composer-package-action php app.php ``` testing ```shell -docker run --rm -e GITHUB_WORKSPACE=/usr/bin/app -v .:/usr/bin/app composer-package-action composer tests +docker run --rm -v .:/usr/bin/app composer-package-action composer tests ``` diff --git a/tests/ActionTest.php b/tests/ActionTest.php index d6ff8d0..5ab3098 100644 --- a/tests/ActionTest.php +++ b/tests/ActionTest.php @@ -11,17 +11,11 @@ #[CoversClass(Action::class)] final class ActionTest extends TestCase { - /** - * @var string - */ - private const string DEFAULT_ENV_GITHUB_WORKSPACE = '/usr/bin/app'; - private ?Action $action; #[\Override] protected function setUp(): void { - putenv('GITHUB_WORKSPACE=' . self::DEFAULT_ENV_GITHUB_WORKSPACE); putenv('directory=.build'); $this->action = new Action(); @@ -32,7 +26,6 @@ protected function setUp(): void #[\Override] protected function tearDown(): void { - putenv('GITHUB_WORKSPACE='); putenv('directory='); $this->removeBuildDirectory(); @@ -71,7 +64,7 @@ private function removeDirectory(string $dir): void { $dir = realpath($dir); - if (is_dir($dir)) { + if (is_dir($dir) && is_readable($dir) && is_writable($dir)) { $iterator = new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator($dir),