mirror of
https://github.com/creyD/prettier_action.git
synced 2026-04-20 07:10:32 +02:00
Compare commits
8 Commits
v4.5
...
claude/sho
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c29ec09bf | ||
| 8c18391fdc | |||
| 6b98d6d1d4 | |||
| afbe64738b | |||
|
|
6a7b2d092f | ||
| af8ff244c5 | |||
| acebb0f4d5 | |||
| b185d84b38 |
@@ -60,7 +60,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Prettify code
|
- name: Prettify code
|
||||||
uses: creyD/prettier_action@v4.4
|
uses: creyD/prettier_action@v4.6
|
||||||
with:
|
with:
|
||||||
# This part is also where you can pass other options, for example:
|
# This part is also where you can pass other options, for example:
|
||||||
prettier_options: --write **/*.{js,md}
|
prettier_options: --write **/*.{js,md}
|
||||||
@@ -89,7 +89,7 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Prettify code
|
- name: Prettify code
|
||||||
uses: creyD/prettier_action@v4.4
|
uses: creyD/prettier_action@v4.6
|
||||||
with:
|
with:
|
||||||
# This part is also where you can pass other options, for example:
|
# This part is also where you can pass other options, for example:
|
||||||
prettier_options: --write **/*.{js,md}
|
prettier_options: --write **/*.{js,md}
|
||||||
@@ -119,7 +119,7 @@ jobs:
|
|||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Prettify code
|
- name: Prettify code
|
||||||
uses: creyD/prettier_action@v4.4
|
uses: creyD/prettier_action@v4.6
|
||||||
with:
|
with:
|
||||||
prettier_options: --write **/*.{js,md}
|
prettier_options: --write **/*.{js,md}
|
||||||
only_changed: True
|
only_changed: True
|
||||||
@@ -150,7 +150,7 @@ jobs:
|
|||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Prettify code
|
- name: Prettify code
|
||||||
uses: creyD/prettier_action@v4.4
|
uses: creyD/prettier_action@v4.6
|
||||||
with:
|
with:
|
||||||
dry: True
|
dry: True
|
||||||
github_token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
|
github_token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ EOF
|
|||||||
# If GIT_IDENTITY="actor"
|
# If GIT_IDENTITY="actor"
|
||||||
if [ "$INPUT_GIT_IDENTITY" = "author" ]; then
|
if [ "$INPUT_GIT_IDENTITY" = "author" ]; then
|
||||||
git config --global user.name "$GITHUB_ACTOR"
|
git config --global user.name "$GITHUB_ACTOR"
|
||||||
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
git config --global user.email "$GITHUB_ACTOR_ID+$GITHUB_ACTOR@users.noreply.github.com"
|
||||||
elif [ "$INPUT_GIT_IDENTITY" = "actions" ]; then
|
elif [ "$INPUT_GIT_IDENTITY" = "actions" ]; then
|
||||||
git config --global user.email "actions@github.com"
|
git config --global user.email "actions@github.com"
|
||||||
git config --global user.name "GitHub Action"
|
git config --global user.name "GitHub Action"
|
||||||
@@ -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
|
||||||
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