mirror of
https://github.com/creyD/prettier_action.git
synced 2026-04-12 19:30:30 +02:00
feat: #98 added option to allow for other plugins
This commit is contained in:
@@ -70,6 +70,10 @@ inputs:
|
||||
description: Which identity is used for git name/email when committing changes. Needs to be one of "actions" or "author".
|
||||
required: false
|
||||
default: "actions"
|
||||
allow_other_plugins:
|
||||
description: Allow other plugins to be installed. By default, we are checking if the plugins are actually prettier plugins.
|
||||
required: false
|
||||
default: false
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
@@ -97,6 +101,7 @@ runs:
|
||||
INPUT_GITHUB_TOKEN: ${{ inputs.github_token }}
|
||||
INPUT_CLEAN_NODE_FOLDER: ${{ inputs.clean_node_folder }}
|
||||
INPUT_GIT_IDENTITY: ${{ inputs.git_identity }}
|
||||
INPUT_ALLOW_OTHER_PLUGINS: ${{ inputs.allow_other_plugins }}
|
||||
|
||||
branding:
|
||||
icon: "award"
|
||||
|
||||
@@ -49,14 +49,16 @@ npm install --silent prettier@$INPUT_PRETTIER_VERSION
|
||||
|
||||
# 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\-]+\/)?prettier-plugin-){1}([a-z\-]+)'; then
|
||||
echo "$plugin does not seem to be a valid @prettier/plugin-x plugin. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
if [ "$INPUT_ALLOW_OTHER_PLUGINS" != "true" ]; 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\-]+\/)?prettier-plugin-){1}([a-z\-]+)'; then
|
||||
echo "$plugin does not seem to be a valid @prettier/plugin-x plugin. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
npm install --silent $INPUT_PRETTIER_PLUGINS
|
||||
fi
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user