mirror of
https://github.com/creyD/prettier_action.git
synced 2026-04-13 03:40:31 +02:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cb975d8aad | |||
| acf2e1f70b | |||
| ad03b42b19 | |||
| a20371f2d2 | |||
|
|
2b4b2c18e7 | ||
|
|
8d84d9c9f2 | ||
|
|
c0b1f6f05a | ||
|
|
bb1392436f | ||
|
|
d8e72fc127 | ||
|
|
75b0a4fda5 | ||
|
|
bb1dafe218 | ||
|
|
33b1eff486 | ||
|
|
72b033eda5 | ||
|
|
656daa9f97 | ||
|
|
1015fa1aaf | ||
|
|
0faaf9bad1 | ||
|
|
a35b5cc1cb | ||
|
|
b7cf1dc4c2 | ||
|
|
f852cea42f | ||
|
|
7ea4328121 | ||
|
|
193559158f | ||
| 34cc6fde0a | |||
|
|
03caf85843 |
@@ -23,7 +23,7 @@ A GitHub action for styling files with [prettier](https://prettier.io).
|
|||||||
| same_commit | :x: | `false` | Update the current commit instead of creating a new one, created by [Joren Broekema](https://github.com/jorenbroekema), this command works only with the checkout action set to fetch depth '0' (see example 2) |
|
| same_commit | :x: | `false` | Update the current commit instead of creating a new one, created by [Joren Broekema](https://github.com/jorenbroekema), this command works only with the checkout action set to fetch depth '0' (see example 2) |
|
||||||
| commit_message | :x: | `"Prettified Code!"` | Custom git commit message, will be ignored if used with `same_commit` |
|
| commit_message | :x: | `"Prettified Code!"` | Custom git commit message, will be ignored if used with `same_commit` |
|
||||||
| file_pattern | :x: | `*` | Custom git add file pattern, can't be used with only_changed! |
|
| file_pattern | :x: | `*` | Custom git add file pattern, can't be used with only_changed! |
|
||||||
| branch (deprecated with 3.0)| :white_check_mark: | - | Always set this to `${{ github.head_ref }}` in order to work both with pull requests and push events |
|
| prettier_plugins | :x: | ` ` | Install Prettier plugins, i.e. `@prettier/prettier-php @prettier/some-other-plugin` |
|
||||||
| only_changed | :x: | `false` | Only prettify changed files, can't be used with file_pattern! This command works only with the checkout action set to fetch depth '0' (see example 2)|
|
| only_changed | :x: | `false` | Only prettify changed files, can't be used with file_pattern! This command works only with the checkout action set to fetch depth '0' (see example 2)|
|
||||||
|
|
||||||
> Note: using the same_commit option may lead to problems if other actions are relying on the commit being the same before and after the prettier action has ran. Keep this in mind.
|
> Note: using the same_commit option may lead to problems if other actions are relying on the commit being the same before and after the prettier action has ran. Keep this in mind.
|
||||||
|
|||||||
@@ -35,6 +35,10 @@ inputs:
|
|||||||
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
|
||||||
default: false
|
default: false
|
||||||
|
prettier_plugins:
|
||||||
|
description: Install Prettier plugins, i.e. `@prettier/prettier-php @prettier/some-other-plugin`
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
|
|||||||
@@ -36,6 +36,19 @@ case $INPUT_PRETTIER_VERSION in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Install plugins
|
||||||
|
if [ -n "$INPUT_PRETTIER_PLUGINS" ]; then
|
||||||
|
for plugin in $INPUT_PRETTIER_PLUGINS; do
|
||||||
|
echo "Checking plugin: $plugin"
|
||||||
|
# check regex against @prettier/xyz
|
||||||
|
if ! echo "$plugin" | grep -Eq '(@prettier\/)+(plugin-[a-z\-]+)'; then
|
||||||
|
echo "$plugin does not seem to be a valid @prettier/plugin-x plugin. Exiting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
npm install --silent --global $INPUT_PRETTIER_PLUGINS
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Prettifing files..."
|
echo "Prettifing files..."
|
||||||
echo "Files:"
|
echo "Files:"
|
||||||
prettier $INPUT_PRETTIER_OPTIONS || echo "Problem running prettier with $INPUT_PRETTIER_OPTIONS"
|
prettier $INPUT_PRETTIER_OPTIONS || echo "Problem running prettier with $INPUT_PRETTIER_OPTIONS"
|
||||||
|
|||||||
Reference in New Issue
Block a user