From e2704493afdf1f5ae9ced0208435652e3325df9a Mon Sep 17 00:00:00 2001 From: Conrad Date: Thu, 8 May 2025 13:20:52 +0200 Subject: [PATCH] feat: #98 added option to allow for other plugins --- action.yml | 5 +++++ entrypoint.sh | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/action.yml b/action.yml index 54dbc65..5072dcd 100644 --- a/action.yml +++ b/action.yml @@ -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" diff --git a/entrypoint.sh b/entrypoint.sh index 7ba5200..d23f779 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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 )