Skip to content

Commit 0b6f170

Browse files
authored
Merge pull request #25 from alexhackney/add-pint-parallel-option
Added the option to run pint in parallel mode in v1.23 or higher
2 parents 22dd721 + 5b17499 commit 0b6f170

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

action.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ inputs:
2525
onlyDiff:
2626
description: "only format changed files that differ from the provided branch"
2727
required: false
28-
28+
29+
parallel:
30+
description: "run Pint in parallel mode (requires Pint >= 1.23)"
31+
required: false
32+
2933
pintVersion:
3034
description: "laravel/pint composer version to install a specific version."
3135
required: false
32-
36+
3337
useComposer:
3438
description: "Use Laravel Pint version from project composer lock file. Lock file must be preset to use this flag."
3539
required: false
@@ -42,6 +46,8 @@ runs:
4246
- ${{ inputs.config-path }}
4347
- ${{ inputs.preset }}
4448
- ${{ inputs.only-dirty }}
49+
- ${{ inputs.onlyDiff }}
50+
- ${{ inputs.parallel }}
4551
- ${{ inputs.pint-version }}
4652
- ${{ inputs.use-composer }}
4753
branding:

entrypoint.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
set -e
33

44
pint_install_command=("composer global require laravel/pint:PINT_VERSION --no-progress --dev")
5-
65
if [[ "${INPUT_PINTVERSION}" ]]
76
then
87
pint_install_command="${pint_install_command/PINT_VERSION/${INPUT_PINTVERSION}}"
@@ -13,8 +12,14 @@ else
1312
pint_install_command="${pint_install_command/:PINT_VERSION/}"
1413
fi
1514

16-
pint_command=("pint")
15+
echo "Running Command: ${pint_install_command[@]}"
16+
${pint_install_command[@]}
17+
PATH="/tmp/vendor/bin:${PATH}"
1718

19+
pint_version=$(pint --version | grep -oE '[0-9]+\.[0-9]+(\.[0-9]+)?' | head -1)
20+
version_check=$(printf '%s\n1.23' "$pint_version" | sort -V | head -1)
21+
22+
pint_command=("pint")
1823
if [[ "${INPUT_TESTMODE}" == true ]]; then
1924
pint_command+=" --test"
2025
fi
@@ -39,9 +44,15 @@ if [[ "${INPUT_ONLYDIRTY}" == true ]]; then
3944
pint_command+=" --dirty"
4045
fi
4146

42-
echo "Running Command: " "${pint_install_command[@]}"
47+
if [[ "${INPUT_PARALLEL}" == true ]]; then
48+
if [[ "$version_check" == "1.23" ]]; then
49+
pint_command+=" --parallel"
50+
echo "Parallel mode enabled (Pint version: $pint_version)"
51+
else
52+
echo "Warning: Parallel mode requested but Pint version $pint_version < 1.23. Skipping --parallel flag."
53+
fi
54+
fi
4355

44-
${pint_install_command[@]}
4556
PATH="/tmp/vendor/bin:${PATH}"
4657

4758
echo "Running Command: " "${pint_command[@]}"

0 commit comments

Comments
 (0)