Added documentation for dry option

This commit is contained in:
2020-03-16 16:03:20 +01:00
parent 527f15c634
commit 8790b043b6
2 changed files with 3 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ A GitHub action for styling files with [prettier](https://prettier.io).
| Parameter | Required | Default | Description | | Parameter | Required | Default | Description |
| - | :-: | :-: | - | | - | :-: | :-: | - |
| dry | :x: | False | Runs the action in dry mode. Files wont get changed and the action fails if there are unprettified files. |
| prettier_options | :x: | `--write **/*.js` | Prettier options (by default it applies to the whole repository) | | prettier_options | :x: | `--write **/*.js` | Prettier options (by default it applies to the whole repository) |
| commit_options | :x: | - | Custom git commit options | | commit_options | :x: | - | Custom git commit options |
| commit_message | :x: | Prettified Code! | Custom git commit message | | commit_message | :x: | Prettified Code! | Custom git commit message |

View File

@@ -41,12 +41,13 @@ npm install --silent --global prettier
echo "Prettifing files..." echo "Prettifing files..."
echo "Files:" echo "Files:"
prettier $INPUT_PRETTIER_OPTIONS prettier $INPUT_PRETTIER_OPTIONS || echo "Problem running prettier with $INPUT_PRETTIER_OPTIONS"
# To keep runtime good, just continue if something was changed # To keep runtime good, just continue if something was changed
if _git_changed; if _git_changed;
then then
if $INPUT_DRY; then if $INPUT_DRY; then
echo "Prettier found unpretty files."
exit 1 exit 1
else else
# Calling method to configure the git environemnt # Calling method to configure the git environemnt