Skip to content

Commit

Permalink
Added default for working_directory
Browse files Browse the repository at this point in the history
  • Loading branch information
creyD committed May 24, 2023
1 parent d04162e commit 473978a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 1 addition & 9 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 473978a

Please sign in to comment.