mirror of
https://github.com/creyD/prettier_action.git
synced 2026-04-15 21:00:35 +02:00
fix(issue-37): adds logic to handle prettier cmd output to shell dry-run exit
This commit is contained in:
@@ -52,12 +52,21 @@ fi
|
|||||||
echo "Prettifing files..."
|
echo "Prettifing files..."
|
||||||
echo "Files:"
|
echo "Files:"
|
||||||
prettier $INPUT_PRETTIER_OPTIONS || echo "Problem running prettier with $INPUT_PRETTIER_OPTIONS"
|
prettier $INPUT_PRETTIER_OPTIONS || echo "Problem running prettier with $INPUT_PRETTIER_OPTIONS"
|
||||||
|
PRETTIER_RESULT=$?
|
||||||
|
|
||||||
|
# Ignore node modules and other action created files
|
||||||
|
rm -r node_modules/ || echo "No node_modules/ folder."
|
||||||
|
git reset --hard package-lock.json || rm package-lock.json || echo "No package-lock.json file."
|
||||||
|
|
||||||
# To keep runtime good, just continue if something was changed
|
# To keep runtime good, just continue if something was changed
|
||||||
if _git_changed; then
|
if _git_changed; then
|
||||||
if $INPUT_DRY; then
|
if $INPUT_DRY; then
|
||||||
echo "Prettier found unpretty files!"
|
if [[ "$PRETTIER_RESULT" -eq 1 ]]; then
|
||||||
exit 1
|
echo "Prettier found unpretty files!"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "No unpretty files! Finishing dry-run."
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
# Calling method to configure the git environemnt
|
# Calling method to configure the git environemnt
|
||||||
_git_setup
|
_git_setup
|
||||||
|
|||||||
Reference in New Issue
Block a user