mirror of
https://github.com/creyD/prettier_action.git
synced 2026-04-15 12:50:31 +02:00
Added working_directory parameter
This commit is contained in:
@@ -18,6 +18,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 |
|
| 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: | `false` | Specific prettier version (by default use latest) |
|
| prettier_version | :x: | `false` | Specific prettier version (by default use latest) |
|
||||||
|
| working_directory | :x: | `false` | Specify a directory to cd into before installing prettier and running it |
|
||||||
| 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 |
|
||||||
| push_options | :x: | - | Custom git push options |
|
| push_options | :x: | - | Custom git push options |
|
||||||
|
|||||||
@@ -38,6 +38,10 @@ inputs:
|
|||||||
description: Specific version of prettier (by default just use the latest version)
|
description: Specific version of prettier (by default just use the latest version)
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
|
working_directory:
|
||||||
|
description: Specify a directory to cd into before installing prettier and running it
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
only_changed:
|
only_changed:
|
||||||
description: Only prettify files changed in the last commit, can't be used with file_pattern!
|
description: Only prettify files changed in the last commit, can't be used with file_pattern!
|
||||||
required: false
|
required: false
|
||||||
@@ -45,13 +49,12 @@ inputs:
|
|||||||
prettier_plugins:
|
prettier_plugins:
|
||||||
description: Install Prettier plugins, i.e. `@prettier/plugin-php @prettier/plugin-other`
|
description: Install Prettier plugins, i.e. `@prettier/plugin-php @prettier/plugin-other`
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ""
|
||||||
github_token:
|
github_token:
|
||||||
description: GitHub Token or PAT token used to authenticate against a repository
|
description: GitHub Token or PAT token used to authenticate against a repository
|
||||||
required: false
|
required: false
|
||||||
default: ${{ github.token }}
|
default: ${{ github.token }}
|
||||||
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
@@ -71,6 +74,7 @@ runs:
|
|||||||
INPUT_PRETTIER_VERSION: ${{ inputs.prettier_version }}
|
INPUT_PRETTIER_VERSION: ${{ inputs.prettier_version }}
|
||||||
INPUT_ONLY_CHANGED: ${{ inputs.only_changed }}
|
INPUT_ONLY_CHANGED: ${{ inputs.only_changed }}
|
||||||
INPUT_PRETTIER_PLUGINS: ${{ inputs.prettier_plugins }}
|
INPUT_PRETTIER_PLUGINS: ${{ inputs.prettier_plugins }}
|
||||||
|
INPUT_WORKING_DIRECTORY: ${{ inputs.working_directory }}
|
||||||
INPUT_GITHUB_TOKEN: ${{ inputs.github_token }}
|
INPUT_GITHUB_TOKEN: ${{ inputs.github_token }}
|
||||||
|
|
||||||
branding:
|
branding:
|
||||||
|
|||||||
@@ -37,6 +37,14 @@ cd "$GITHUB_ACTION_PATH"
|
|||||||
|
|
||||||
echo "Installing prettier..."
|
echo "Installing prettier..."
|
||||||
|
|
||||||
|
case $INPUT_WORKING_DIRECTORY in
|
||||||
|
false)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
cd $INPUT_WORKING_DIRECTORY
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
case $INPUT_PRETTIER_VERSION in
|
case $INPUT_PRETTIER_VERSION in
|
||||||
false)
|
false)
|
||||||
npm install --silent prettier
|
npm install --silent prettier
|
||||||
|
|||||||
Reference in New Issue
Block a user