mirror of
https://github.com/creyD/prettier_action.git
synced 2026-04-12 19:30:30 +02:00
Added default for working_directory
This commit is contained in:
@@ -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 |
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user