|
1 | 1 | #!/bin/bash |
2 | 2 | set -e |
3 | 3 |
|
| 4 | +# Install Pint |
4 | 5 | pint_install_command=("composer global require laravel/pint:PINT_VERSION --no-progress --dev") |
5 | | - |
6 | 6 | if [[ "${INPUT_PINTVERSION}" ]] |
7 | 7 | then |
8 | 8 | pint_install_command="${pint_install_command/PINT_VERSION/${INPUT_PINTVERSION}}" |
|
13 | 13 | pint_install_command="${pint_install_command/:PINT_VERSION/}" |
14 | 14 | fi |
15 | 15 |
|
16 | | -pint_command=("pint") |
| 16 | +echo "Running Command: " "${pint_install_command[@]}" |
| 17 | +${pint_install_command[@]} |
| 18 | +PATH="/tmp/vendor/bin:${PATH}" |
| 19 | + |
| 20 | +# Get version after installation |
| 21 | +pint_version=$(pint --version | grep -oE '[0-9]+\.[0-9]+(\.[0-9]+)?' | head -1) |
| 22 | +version_check=$(printf '%s\n1.23' "$pint_version" | sort -V | head -1) |
17 | 23 |
|
| 24 | +# Build command with consistent array syntax |
| 25 | +pint_command=("pint") |
18 | 26 | if [[ "${INPUT_TESTMODE}" == true ]]; then |
19 | | - pint_command+=" --test" |
| 27 | + pint_command+=("--test") |
20 | 28 | fi |
21 | 29 |
|
22 | 30 | if [[ "${INPUT_VERBOSEMODE}" == true ]]; then |
23 | | - pint_command+=" -v" |
| 31 | + pint_command+=("-v") |
24 | 32 | fi |
25 | 33 |
|
26 | 34 | if [[ "${INPUT_CONFIGPATH}" ]]; then |
27 | | - pint_command+=" --config ${INPUT_CONFIGPATH}" |
| 35 | + pint_command+=("--config" "${INPUT_CONFIGPATH}") |
28 | 36 | fi |
29 | 37 |
|
30 | 38 | if [[ "${INPUT_PRESET}" ]]; then |
31 | | - pint_command+=" --preset ${INPUT_PRESET}" |
| 39 | + pint_command+=("--preset" "${INPUT_PRESET}") |
32 | 40 | fi |
33 | 41 |
|
34 | 42 | if [[ "${INPUT_ONLYDIFF}" ]]; then |
35 | | - pint_command+=" --diff=${INPUT_ONLYDIFF}" |
| 43 | + pint_command+=("--diff=${INPUT_ONLYDIFF}") |
36 | 44 | fi |
37 | 45 |
|
38 | 46 | if [[ "${INPUT_ONLYDIRTY}" == true ]]; then |
39 | | - pint_command+=" --dirty" |
| 47 | + pint_command+=("--dirty") |
40 | 48 | fi |
41 | 49 |
|
42 | | -echo "Running Command: " "${pint_install_command[@]}" |
43 | | - |
44 | | -${pint_install_command[@]} |
45 | | -PATH="/tmp/vendor/bin:${PATH}" |
| 50 | +if [[ "${INPUT_PARALLEL}" == true ]]; then |
| 51 | + if [[ "$version_check" == "1.23" ]]; then |
| 52 | + pint_command+=("--parallel") |
| 53 | + echo "Parallel mode enabled (Pint version: $pint_version)" |
| 54 | + else |
| 55 | + echo "Warning: Parallel mode requested but Pint version $pint_version < 1.23. Skipping --parallel flag." |
| 56 | + fi |
| 57 | +fi |
46 | 58 |
|
47 | 59 | echo "Running Command: " "${pint_command[@]}" |
48 | 60 |
|
49 | | -${pint_command[@]} |
| 61 | +"${pint_command[@]}" |
0 commit comments