Skip to content

Commit

Permalink
Merge pull request #3 from aglipanci/version-based-pint
Browse files Browse the repository at this point in the history
Adding option to configure Pint version used.
  • Loading branch information
aglipanci authored Dec 26, 2022
2 parents a95c07f + 203c2fe commit c4b9ef6
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 12 deletions.
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
FROM composer:latest

RUN composer global require laravel/pint --no-progress --dev
ENV PATH="/tmp/vendor/bin:${PATH}"

COPY "entrypoint.sh" "/entrypoint.sh"
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
ENTRYPOINT ["/entrypoint.sh"]
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ inputs:
preset:
description: "pint preset"
required: false

pintVersion:
description: "larave/pint composer version to install a specific version."
required: false
runs:
using: 'docker'
image: 'Dockerfile'
Expand All @@ -25,6 +29,7 @@ runs:
- ${{ inputs.verbose-mode }}
- ${{ inputs.config-path }}
- ${{ inputs.preset }}
- ${{ inputs.pint-version }}
branding:
icon: 'eye'
color: 'gray-dark'
color: 'gray-dark'
28 changes: 21 additions & 7 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,38 @@
#!/bin/bash
set -e

command_string=("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}}"
else
pint_install_command="${pint_install_command/:PINT_VERSION/}"
fi

pint_command=("pint")

if [[ "${INPUT_TESTMODE}" ]]; then
command_string+=" --test"
pint_command+=" --test"
fi

if [[ "${INPUT_VERBOSEMODE}" ]]; then
command_string+=" -v"
pint_command+=" -v"
fi

if [[ "${INPUT_CONFIGPATH}" ]]; then
command_string+=" --config ${INPUT_CONFIGPATH}"
pint_command+=" --config ${INPUT_CONFIGPATH}"
fi

if [[ "${INPUT_PRESET}" ]]; then
command_string+=" --preset ${INPUT_PRESET}"
pint_command+=" --preset ${INPUT_PRESET}"
fi

echo "Running Command: " "${command_string[@]}"
echo "Running Command: " "${pint_install_command[@]}"

${pint_install_command[@]}
PATH="/tmp/vendor/bin:${PATH}"

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

${command_string[@]}
${pint_command[@]}

0 comments on commit c4b9ef6

Please sign in to comment.