Added default for working_directory

This commit is contained in:
2023-05-24 11:05:21 +02:00
parent d04162ee72
commit 473978add9
3 changed files with 3 additions and 11 deletions

View File

@@ -17,7 +17,7 @@ A GitHub action for styling files with [prettier](https://prettier.io).
| - | :-: | :-: | - |
| dry | :x: | `false` | Runs the action in dry mode. Files wont get changed and the action fails if there are unprettified files. Recommended to use with prettier_options --check |
| prettier_version | :x: | `latest` | Specific prettier version (by default use latest) |
| working_directory | :x: | - | Specify a directory to cd into before installing prettier and running it, use relative file path to the repository root for example `app/` |
| working_directory | :x: | `${{ github.action_path }}` | Specify a directory to cd into before installing prettier and running it, use relative file path to the repository root for example `app/` |
| prettier_options | :x: | `"--write **/*.js"` | Prettier options (by default it applies to the whole repository) |
| commit_options | :x: | - | Custom git commit options |
| push_options | :x: | - | Custom git push options |

View File

@@ -41,7 +41,7 @@ inputs:
working_directory:
description: Specify a directory to cd into before installing prettier and running it
required: false
default: false
default: ${{ github.action_path }}
only_changed:
description: Only prettify files changed in the last commit, can't be used with file_pattern!
required: false

View File

@@ -29,18 +29,10 @@ _git_changed() {
(
# PROGRAM
# Changing to the directory
cd "$GITHUB_ACTION_PATH"
cd "$INPUT_WORKING_DIRECTORY"
echo "Installing prettier..."
case $INPUT_WORKING_DIRECTORY in
false)
;;
*)
cd $INPUT_WORKING_DIRECTORY
;;
esac
npm install --silent prettier@$INPUT_PRETTIER_VERSION
# Install plugins