From 4833b08e7c4ccfd82335705c62194e0d13bf6496 Mon Sep 17 00:00:00 2001 From: Yoriiis <2563298+yoriiis@users.noreply.github.com> Date: Mon, 9 Feb 2026 17:03:25 +0100 Subject: [PATCH 1/3] Fix branch checkout logic --- entrypoint.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/entrypoint.php b/entrypoint.php index 5d9b7cf..e44e3f9 100755 --- a/entrypoint.php +++ b/entrypoint.php @@ -46,9 +46,10 @@ note(sprintf('Trying to checkout %s branch', $config->getBranch())); // if the given branch doesn't exist it returns empty string -$branchSwitchedSuccessfully = execOrDie(sprintf('git checkout %s', $config->getBranch())) !== ''; +exec(sprintf('git checkout %s', $config->getBranch()), $output, $exitCode); +$branchSwitchedSuccessfully = ($exitCode === 0); -// if the branch doesn't exist we creat it and push to origin +// if the branch doesn't exist we create it and push to origin // otherwise we just checkout to the given branch if (!$branchSwitchedSuccessfully) { note(sprintf('Creating branch "%s" as it doesn\'t exist', $config->getBranch())); From 00e085e4d761ea03802fbd61db279daf70235b0f Mon Sep 17 00:00:00 2001 From: Dan Harrin Date: Mon, 9 Feb 2026 16:53:04 +0000 Subject: [PATCH 2/3] Fix spacing in conditional statements --- entrypoint.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.php b/entrypoint.php index e44e3f9..31272cc 100755 --- a/entrypoint.php +++ b/entrypoint.php @@ -51,7 +51,7 @@ // if the branch doesn't exist we create it and push to origin // otherwise we just checkout to the given branch -if (!$branchSwitchedSuccessfully) { +if (! $branchSwitchedSuccessfully) { note(sprintf('Creating branch "%s" as it doesn\'t exist', $config->getBranch())); exec_with_output_print(sprintf('git checkout -b %s', $config->getBranch())); @@ -169,7 +169,7 @@ function list_directory_files(string $directory): void function execOrDie(string $command, ?array &$output = []): string|false { $result = exec($command, $output, $errorCode); - if (0 === $errorCode) { + if ($errorCode === 0) { return $result; } From c7265bd7da070cee36fe2e33b11a289c723bda7a Mon Sep 17 00:00:00 2001 From: Dan Harrin Date: Mon, 9 Feb 2026 16:55:01 +0000 Subject: [PATCH 3/3] Add execOrDie helper function for command execution --- entrypoint.php | 1 + 1 file changed, 1 insertion(+) diff --git a/entrypoint.php b/entrypoint.php index 31272cc..08f4bcb 100755 --- a/entrypoint.php +++ b/entrypoint.php @@ -166,6 +166,7 @@ function list_directory_files(string $directory): void /********************* helper functions *********************/ +/** @phpstan-ignore-next-line */ function execOrDie(string $command, ?array &$output = []): string|false { $result = exec($command, $output, $errorCode);