Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding option to configure Pint version used. #3

Merged
merged 6 commits into from Dec 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions Dockerfile
@@ -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
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
@@ -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[@]}