mirror of
https://github.com/creyD/prettier_action.git
synced 2026-04-16 21:30:31 +02:00
Compare commits
2 Commits
dev
...
claude/sho
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c29ec09bf | ||
| 8c18391fdc |
@@ -74,6 +74,10 @@ inputs:
|
|||||||
description: Allow other plugins to be installed. By default, we are checking if the plugins are actually prettier plugins.
|
description: Allow other plugins to be installed. By default, we are checking if the plugins are actually prettier plugins.
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
|
only_show_changed:
|
||||||
|
description: Only show files that were changed by Prettier instead of all processed files. Useful for large projects where output is overwhelming.
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
@@ -102,6 +106,7 @@ runs:
|
|||||||
INPUT_CLEAN_NODE_FOLDER: ${{ inputs.clean_node_folder }}
|
INPUT_CLEAN_NODE_FOLDER: ${{ inputs.clean_node_folder }}
|
||||||
INPUT_GIT_IDENTITY: ${{ inputs.git_identity }}
|
INPUT_GIT_IDENTITY: ${{ inputs.git_identity }}
|
||||||
INPUT_ALLOW_OTHER_PLUGINS: ${{ inputs.allow_other_plugins }}
|
INPUT_ALLOW_OTHER_PLUGINS: ${{ inputs.allow_other_plugins }}
|
||||||
|
INPUT_ONLY_SHOW_CHANGED: ${{ inputs.only_show_changed }}
|
||||||
|
|
||||||
branding:
|
branding:
|
||||||
icon: "award"
|
icon: "award"
|
||||||
|
|||||||
@@ -65,12 +65,27 @@ fi
|
|||||||
|
|
||||||
PRETTIER_RESULT=0
|
PRETTIER_RESULT=0
|
||||||
echo "Prettifying files..."
|
echo "Prettifying files..."
|
||||||
echo "Files:"
|
if [ "$INPUT_ONLY_SHOW_CHANGED" = "true" ]; then
|
||||||
npx prettier $INPUT_PRETTIER_OPTIONS \
|
# New behavior: don't show all files, only show changed files later
|
||||||
|| { PRETTIER_RESULT=$?; echo "Problem running prettier with $INPUT_PRETTIER_OPTIONS"; exit 1; } >> $GITHUB_STEP_SUMMARY
|
npx prettier $INPUT_PRETTIER_OPTIONS \
|
||||||
|
|| { PRETTIER_RESULT=$?; echo "Problem running prettier with $INPUT_PRETTIER_OPTIONS"; exit 1; }
|
||||||
|
else
|
||||||
|
# Original behavior: show all files processed by prettier
|
||||||
|
echo "Files:"
|
||||||
|
npx prettier $INPUT_PRETTIER_OPTIONS \
|
||||||
|
|| { PRETTIER_RESULT=$?; echo "Problem running prettier with $INPUT_PRETTIER_OPTIONS"; exit 1; } >> $GITHUB_STEP_SUMMARY
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Prettier result: $PRETTIER_RESULT"
|
echo "Prettier result: $PRETTIER_RESULT"
|
||||||
|
|
||||||
|
# Show only the files that were changed by prettier (when flag is enabled)
|
||||||
|
if [ "$INPUT_ONLY_SHOW_CHANGED" = "true" ] && _git_changed; then
|
||||||
|
echo ""
|
||||||
|
echo "Changed files:"
|
||||||
|
git status --short | tee -a $GITHUB_STEP_SUMMARY
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
# Removing the node_modules folder, so it doesn't get committed if it is not added in gitignore
|
# Removing the node_modules folder, so it doesn't get committed if it is not added in gitignore
|
||||||
if $INPUT_CLEAN_NODE_FOLDER; then
|
if $INPUT_CLEAN_NODE_FOLDER; then
|
||||||
echo "Deleting node_modules/ folder..."
|
echo "Deleting node_modules/ folder..."
|
||||||
|
|||||||
Reference in New Issue
Block a user