Context
Two bugs discovered while investigating a failed deployment on tonyputi/sikaniaimmobiliare-com (run #23714054528).
Bug 1 — --graceful flag breaks Laravel 9 deployments (blocker)
File: scripts/deploy-laravel-app.sh, line 49
sudo -u $APP_USER php $RELEASE_PATH/artisan migrate --force --graceful --ansi -qn
The --graceful flag was introduced in Laravel 10. Any repo using Laravel 9 will fail at the migration step with:
The "--graceful" option does not exist.
Fix: auto-detect the Laravel major version at runtime and conditionally apply the flag:
echo "🗄️ Running migrations..."
GRACEFUL=""
LARAVEL_MAJOR=$(php $RELEASE_PATH/artisan --version 2>/dev/null | grep -oP 'Laravel Framework \K\d+' || echo "0")
if [ "${LARAVEL_MAJOR:-0}" -ge 10 ]; then
GRACEFUL="--graceful"
fi
sudo -u $APP_USER php $RELEASE_PATH/artisan migrate --force $GRACEFUL --ansi -qn
Bug 2 — composer config cache-files-dir runs without working directory (non-blocking)
File: actions/setup/composer/action.yml, step Get composer cache directory
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
Composer requires a composer.json in the current directory unless -g (global) or -d <dir> is passed. The runner's working directory is the repo root (not build/), so this step prints:
File "./composer.json" cannot be found in the current directory
The error is non-fatal (the workflow continues), but the cache path key ends up containing the error string instead of the actual cache directory, making the cache step ineffective.
Fix: add -d ${{ inputs.working_directory }} to the command:
echo "dir=$(composer config -d ${{ inputs.working_directory }} cache-files-dir)" >> $GITHUB_OUTPUT
Acceptance Criteria
Entry Points
scripts/deploy-laravel-app.sh — line 49
actions/setup/composer/action.yml — step Get composer cache directory
Test / Verification
- Trigger a deployment on a Laravel 9 repo — migration step must complete without errors
- Trigger a deployment on a Laravel 10+ repo —
--graceful must still be applied
- Check that the composer cache key in the workflow log contains a valid directory path (e.g.
/home/runner/.composer/cache/files)
Constraints
- Do NOT add a workflow-level input for
graceful_migrate — this is an implementation detail of the deploy script, not a caller concern
- Do NOT break existing callers
Context
Two bugs discovered while investigating a failed deployment on
tonyputi/sikaniaimmobiliare-com(run #23714054528).Bug 1 —
--gracefulflag breaks Laravel 9 deployments (blocker)File:
scripts/deploy-laravel-app.sh, line 49The
--gracefulflag was introduced in Laravel 10. Any repo using Laravel 9 will fail at the migration step with:Fix: auto-detect the Laravel major version at runtime and conditionally apply the flag:
Bug 2 —
composer config cache-files-dirruns without working directory (non-blocking)File:
actions/setup/composer/action.yml, stepGet composer cache directoryComposer requires a
composer.jsonin the current directory unless-g(global) or-d <dir>is passed. The runner's working directory is the repo root (notbuild/), so this step prints:The error is non-fatal (the workflow continues), but the cache
pathkey ends up containing the error string instead of the actual cache directory, making the cache step ineffective.Fix: add
-d ${{ inputs.working_directory }}to the command:Acceptance Criteria
scripts/deploy-laravel-app.shdetects Laravel version at runtime and applies--gracefulonly on Laravel 10+actions/setup/composer/action.ymlpasses the correct working directory tocomposer config cache-files-dirEntry Points
scripts/deploy-laravel-app.sh— line 49actions/setup/composer/action.yml— stepGet composer cache directoryTest / Verification
--gracefulmust still be applied/home/runner/.composer/cache/files)Constraints
graceful_migrate— this is an implementation detail of the deploy script, not a caller concern