diff --git a/action.yml b/action.yml index cd2d8b2..be1be9d 100644 --- a/action.yml +++ b/action.yml @@ -25,6 +25,10 @@ inputs: pintVersion: description: "laravel/pint composer version to install a specific version." required: false + + useComposer: + description: "Use Laravel Pint version from project composer lock file. Lock file must be preset to use this flag." + required: false runs: using: 'docker' image: 'Dockerfile' @@ -35,6 +39,7 @@ runs: - ${{ inputs.preset }} - ${{ inputs.only-dirty }} - ${{ inputs.pint-version }} + - ${{ inputs.use-composer }} branding: icon: 'eye' color: 'gray-dark' diff --git a/entrypoint.sh b/entrypoint.sh index b91d408..6fb6475 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -6,6 +6,9 @@ pint_install_command=("composer global require laravel/pint:PINT_VERSION --no-pr if [[ "${INPUT_PINTVERSION}" ]] then pint_install_command="${pint_install_command/PINT_VERSION/${INPUT_PINTVERSION}}" +elif [[ "${INPUT_USECOMPOSER}" ]] +then + pint_install_command="${pint_install_command/PINT_VERSION/$(composer show --locked | grep 'laravel/pint' | awk '{print $2}')}" else pint_install_command="${pint_install_command/:PINT_VERSION/}" fi