From 964b229b30ec3daca427c0f3df23225d056a221a Mon Sep 17 00:00:00 2001 From: Alex Hackney Date: Tue, 8 Jul 2025 12:32:54 -0400 Subject: [PATCH 1/9] added the option to run pint in parallel mode in v1.23 or more --- action.yml | 10 ++++++++-- entrypoint.sh | 38 +++++++++++++++++++++++++------------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/action.yml b/action.yml index 1a60611..e616c45 100644 --- a/action.yml +++ b/action.yml @@ -25,11 +25,15 @@ inputs: onlyDiff: description: "only format changed files that differ from the provided branch" required: false - + + parallel: + description: "run Pint in parallel mode (requires Pint >= 1.23)" + required: false + 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 @@ -42,6 +46,8 @@ runs: - ${{ inputs.config-path }} - ${{ inputs.preset }} - ${{ inputs.only-dirty }} + - ${{ inputs.only-diff }} + - ${{ inputs.parallel }} - ${{ inputs.pint-version }} - ${{ inputs.use-composer }} branding: diff --git a/entrypoint.sh b/entrypoint.sh index fff66a7..e0d975b 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,8 +1,8 @@ #!/bin/bash set -e +# Install Pint pint_install_command=("composer global require laravel/pint:PINT_VERSION --no-progress --dev") - if [[ "${INPUT_PINTVERSION}" ]] then pint_install_command="${pint_install_command/PINT_VERSION/${INPUT_PINTVERSION}}" @@ -13,37 +13,49 @@ else pint_install_command="${pint_install_command/:PINT_VERSION/}" fi -pint_command=("pint") +echo "Running Command: " "${pint_install_command[@]}" +${pint_install_command[@]} +PATH="/tmp/vendor/bin:${PATH}" + +# Get version after installation +pint_version=$(pint --version | grep -oE '[0-9]+\.[0-9]+(\.[0-9]+)?' | head -1) +version_check=$(printf '%s\n1.23' "$pint_version" | sort -V | head -1) +# Build command with consistent array syntax +pint_command=("pint") if [[ "${INPUT_TESTMODE}" == true ]]; then - pint_command+=" --test" + pint_command+=("--test") fi if [[ "${INPUT_VERBOSEMODE}" == true ]]; then - pint_command+=" -v" + pint_command+=("-v") fi if [[ "${INPUT_CONFIGPATH}" ]]; then - pint_command+=" --config ${INPUT_CONFIGPATH}" + pint_command+=("--config" "${INPUT_CONFIGPATH}") fi if [[ "${INPUT_PRESET}" ]]; then - pint_command+=" --preset ${INPUT_PRESET}" + pint_command+=("--preset" "${INPUT_PRESET}") fi if [[ "${INPUT_ONLYDIFF}" ]]; then - pint_command+=" --diff=${INPUT_ONLYDIFF}" + pint_command+=("--diff=${INPUT_ONLYDIFF}") fi if [[ "${INPUT_ONLYDIRTY}" == true ]]; then - pint_command+=" --dirty" + pint_command+=("--dirty") fi -echo "Running Command: " "${pint_install_command[@]}" - -${pint_install_command[@]} -PATH="/tmp/vendor/bin:${PATH}" +if [[ "${INPUT_PARALLEL}" == true ]]; then + if [[ "$version_check" == "1.23" ]]; then + pint_command+=("--parallel") + echo "Parallel mode enabled (Pint version: $pint_version)" + else + echo "Warning: Parallel mode requested but Pint version $pint_version < 1.23. Skipping --parallel flag." + fi +fi echo "Running Command: " "${pint_command[@]}" -${pint_command[@]} +"${pint_command[@]}" From c509bff5551bf5ac924f2ada24e00f9fafb28317 Mon Sep 17 00:00:00 2001 From: Alex Hackney Date: Tue, 8 Jul 2025 12:33:57 -0400 Subject: [PATCH 2/9] need these spaces --- entrypoint.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index e0d975b..c2b406e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -24,32 +24,32 @@ version_check=$(printf '%s\n1.23' "$pint_version" | sort -V | head -1) # Build command with consistent array syntax pint_command=("pint") if [[ "${INPUT_TESTMODE}" == true ]]; then - pint_command+=("--test") + pint_command+=(" --test") fi if [[ "${INPUT_VERBOSEMODE}" == true ]]; then - pint_command+=("-v") + pint_command+=(" -v") fi if [[ "${INPUT_CONFIGPATH}" ]]; then - pint_command+=("--config" "${INPUT_CONFIGPATH}") + pint_command+=(" --config" "${INPUT_CONFIGPATH}") fi if [[ "${INPUT_PRESET}" ]]; then - pint_command+=("--preset" "${INPUT_PRESET}") + pint_command+=(" --preset" "${INPUT_PRESET}") fi if [[ "${INPUT_ONLYDIFF}" ]]; then - pint_command+=("--diff=${INPUT_ONLYDIFF}") + pint_command+=(" --diff=${INPUT_ONLYDIFF}") fi if [[ "${INPUT_ONLYDIRTY}" == true ]]; then - pint_command+=("--dirty") + pint_command+=(" --dirty") fi if [[ "${INPUT_PARALLEL}" == true ]]; then if [[ "$version_check" == "1.23" ]]; then - pint_command+=("--parallel") + pint_command+=(" --parallel") echo "Parallel mode enabled (Pint version: $pint_version)" else echo "Warning: Parallel mode requested but Pint version $pint_version < 1.23. Skipping --parallel flag." From e56dd62b26f2a607763df5710216c85881dc93f5 Mon Sep 17 00:00:00 2001 From: Alex Hackney Date: Tue, 8 Jul 2025 12:35:35 -0400 Subject: [PATCH 3/9] style updates --- entrypoint.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index c2b406e..7e7c483 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -13,15 +13,13 @@ else pint_install_command="${pint_install_command/:PINT_VERSION/}" fi -echo "Running Command: " "${pint_install_command[@]}" +echo "Running Command: ${pint_install_command[@]}" ${pint_install_command[@]} PATH="/tmp/vendor/bin:${PATH}" -# Get version after installation pint_version=$(pint --version | grep -oE '[0-9]+\.[0-9]+(\.[0-9]+)?' | head -1) version_check=$(printf '%s\n1.23' "$pint_version" | sort -V | head -1) -# Build command with consistent array syntax pint_command=("pint") if [[ "${INPUT_TESTMODE}" == true ]]; then pint_command+=(" --test") @@ -32,11 +30,11 @@ if [[ "${INPUT_VERBOSEMODE}" == true ]]; then fi if [[ "${INPUT_CONFIGPATH}" ]]; then - pint_command+=(" --config" "${INPUT_CONFIGPATH}") + pint_command+=(" --config ${INPUT_CONFIGPATH}") fi if [[ "${INPUT_PRESET}" ]]; then - pint_command+=(" --preset" "${INPUT_PRESET}") + pint_command+=(" --preset ${INPUT_PRESET}") fi if [[ "${INPUT_ONLYDIFF}" ]]; then @@ -56,6 +54,6 @@ if [[ "${INPUT_PARALLEL}" == true ]]; then fi fi -echo "Running Command: " "${pint_command[@]}" +echo "Running Command: ${pint_command[@]}" "${pint_command[@]}" From a260a3ec3b93d0e73ca5765934f3b8b34c4691d5 Mon Sep 17 00:00:00 2001 From: Alex Hackney Date: Tue, 8 Jul 2025 12:36:32 -0400 Subject: [PATCH 4/9] unneeded --- entrypoint.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 7e7c483..6f2fb00 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -22,32 +22,32 @@ version_check=$(printf '%s\n1.23' "$pint_version" | sort -V | head -1) pint_command=("pint") if [[ "${INPUT_TESTMODE}" == true ]]; then - pint_command+=(" --test") + pint_command+=" --test" fi if [[ "${INPUT_VERBOSEMODE}" == true ]]; then - pint_command+=(" -v") + pint_command+=" -v" fi if [[ "${INPUT_CONFIGPATH}" ]]; then - pint_command+=(" --config ${INPUT_CONFIGPATH}") + pint_command+=" --config ${INPUT_CONFIGPATH}" fi if [[ "${INPUT_PRESET}" ]]; then - pint_command+=(" --preset ${INPUT_PRESET}") + pint_command+=" --preset ${INPUT_PRESET}" fi if [[ "${INPUT_ONLYDIFF}" ]]; then - pint_command+=(" --diff=${INPUT_ONLYDIFF}") + pint_command+=" --diff=${INPUT_ONLYDIFF}" fi if [[ "${INPUT_ONLYDIRTY}" == true ]]; then - pint_command+=(" --dirty") + pint_command+=" --dirty" fi if [[ "${INPUT_PARALLEL}" == true ]]; then if [[ "$version_check" == "1.23" ]]; then - pint_command+=(" --parallel") + pint_command+=" --parallel" echo "Parallel mode enabled (Pint version: $pint_version)" else echo "Warning: Parallel mode requested but Pint version $pint_version < 1.23. Skipping --parallel flag." From f157366817bde47d01c3014b692601c9a69a62eb Mon Sep 17 00:00:00 2001 From: Alex Hackney Date: Tue, 8 Jul 2025 12:38:09 -0400 Subject: [PATCH 5/9] Update entrypoint.sh --- entrypoint.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 6f2fb00..ec04643 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -54,6 +54,11 @@ if [[ "${INPUT_PARALLEL}" == true ]]; then fi fi -echo "Running Command: ${pint_command[@]}" +echo "Running Command: " "${pint_install_command[@]}" -"${pint_command[@]}" +${pint_install_command[@]} +PATH="/tmp/vendor/bin:${PATH}" + +echo "Running Command: " "${pint_command[@]}" + +${pint_command[@]} From e24fc7c8e7219720ba64ec25e6286a1a978d947a Mon Sep 17 00:00:00 2001 From: Alex Hackney Date: Tue, 8 Jul 2025 12:39:05 -0400 Subject: [PATCH 6/9] Minor revisions --- entrypoint.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index ec04643..3b2e33c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,7 +1,6 @@ #!/bin/bash set -e -# Install Pint pint_install_command=("composer global require laravel/pint:PINT_VERSION --no-progress --dev") if [[ "${INPUT_PINTVERSION}" ]] then From 86d87e4187499cc22f986af0ba41fa2aab35d282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agli=20Pan=C3=A7i?= Date: Tue, 22 Jul 2025 11:01:08 +0200 Subject: [PATCH 7/9] Update entrypoint.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- entrypoint.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 3b2e33c..b9a6dcf 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -53,9 +53,6 @@ if [[ "${INPUT_PARALLEL}" == true ]]; then fi fi -echo "Running Command: " "${pint_install_command[@]}" - -${pint_install_command[@]} PATH="/tmp/vendor/bin:${PATH}" echo "Running Command: " "${pint_command[@]}" From 5b174992201fe0c1d4bb0d04a172a44aa38aeaf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agli=20Pan=C3=A7i?= Date: Tue, 22 Jul 2025 11:01:33 +0200 Subject: [PATCH 8/9] Update action.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index e616c45..fa55780 100644 --- a/action.yml +++ b/action.yml @@ -46,7 +46,7 @@ runs: - ${{ inputs.config-path }} - ${{ inputs.preset }} - ${{ inputs.only-dirty }} - - ${{ inputs.only-diff }} + - ${{ inputs.onlyDiff }} - ${{ inputs.parallel }} - ${{ inputs.pint-version }} - ${{ inputs.use-composer }} From 36de00d5f5a8a4e12d443e01671daa12a18f4c79 Mon Sep 17 00:00:00 2001 From: Agli Panci Date: Tue, 22 Jul 2025 11:09:01 +0200 Subject: [PATCH 9/9] Remove redundant PATH modification in entrypoint.sh --- entrypoint.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index b9a6dcf..e506b6a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -53,8 +53,6 @@ if [[ "${INPUT_PARALLEL}" == true ]]; then fi fi -PATH="/tmp/vendor/bin:${PATH}" - echo "Running Command: " "${pint_command[@]}" ${pint_command[@]}