diff --git a/README.md b/README.md index e3fedb5..1fa212a 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/action.yml b/action.yml index 78c267f..c274230 100644 --- a/action.yml +++ b/action.yml @@ -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 diff --git a/entrypoint.sh b/entrypoint.sh index 1f95c4d..3e440bf 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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