diff --git a/README.md b/README.md index 25a9e7b..43cf30f 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,11 @@ Optional. Additional reviewdog flags textlint arguments (i.e. target dir:`doc/*`) +### `package_manager` + +Optional. Package manager used in the repository [npm,yarn,pnpm] +Default is `npm`. + ## Customizes `.textlintrc` put in your repo. diff --git a/action.yml b/action.yml index 4ebc1fa..df9e0dd 100644 --- a/action.yml +++ b/action.yml @@ -35,6 +35,9 @@ inputs: tool_name: description: 'Tool name to use for reviewdog reporter' default: 'textlint' + package_manager: + description: 'Package manager used in the repository' + default: 'npm' runs: using: 'composite' steps: @@ -52,6 +55,7 @@ runs: INPUT_REVIEWDOG_FLAGS: ${{ inputs.reviewdog_flags }} INPUT_TEXTLINT_FLAGS: ${{ inputs.textlint_flags }} INPUT_TOOL_NAME: ${{ inputs.tool_name }} + INPUT_PACKAGE_MANAGER: ${{ inputs.package_manager }} branding: icon: 'alert-octagon' color: 'blue' diff --git a/script.sh b/script.sh index 9237db5..06ca5e6 100755 --- a/script.sh +++ b/script.sh @@ -14,9 +14,19 @@ echo '::endgroup::' echo '::group:: Installing textlint ... https://github.com/textlint/textlint' if [ -x "./node_modules/.bin/textlint" ]; then echo 'already installed' -else +elif [[ "${INPUT_PACKAGE_MANAGER}" == "npm" ]]; then echo 'npm ci start' npm ci +elif [[ "${INPUT_PACKAGE_MANAGER}" == "yarn" ]]; then + echo 'yarn install start' + yarn install +elif [[ "${INPUT_PACKAGE_MANAGER}" == "pnpm" ]]; then + echo 'pnpm install start' + pnpm install +else + echo 'The specified package manager is not supported.' + echo '::endgroup::' + exit 1 fi if [ -x "./node_modules/.bin/textlint" ]; then