diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ff39d5a..f2796d8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,7 @@ jobs: test-pr-check-npm: if: github.event_name == 'pull_request' - name: runner / textlint (github-pr-check) + name: runner / textlint (github-pr-check, npm) runs-on: ubuntu-latest steps: - name: Checkout @@ -46,7 +46,7 @@ jobs: test-pr-check-yarn: if: github.event_name == 'pull_request' - name: runner / textlint (github-pr-check) + name: runner / textlint (github-pr-check, yarn) runs-on: ubuntu-latest steps: - name: Checkout @@ -67,7 +67,7 @@ jobs: test-pr-check-pnpm: if: github.event_name == 'pull_request' - name: runner / textlint (github-pr-check) + name: runner / textlint (github-pr-check, pnpm) runs-on: ubuntu-latest steps: - name: Checkout @@ -90,6 +90,31 @@ jobs: reporter: github-pr-check textlint_flags: "doc/**" + test-pr-check-bun: + if: github.event_name == 'pull_request' + name: runner / textlint (github-pr-check, bun) + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: true + - name: Setup node + uses: actions/setup-node@v1 + with: + node-version: 20 + - name: Setup bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + - name: textlint-github-check + uses: ./ + with: + github_token: ${{ secrets.github_token }} + package_manager: bun + reporter: github-pr-check + textlint_flags: "doc/**" + test-pr-review: if: github.event_name == 'pull_request' name: runner / textlint (github-pr-review) diff --git a/README.md b/README.md index 43cf30f..e186113 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ textlint arguments (i.e. target dir:`doc/*`) ### `package_manager` -Optional. Package manager used in the repository [npm,yarn,pnpm] +Optional. Package manager used in the repository [npm,yarn,pnpm,bun] Default is `npm`. ## Customizes diff --git a/action.yml b/action.yml index ec23ce5..6e3c012 100644 --- a/action.yml +++ b/action.yml @@ -36,7 +36,7 @@ inputs: description: 'Tool name to use for reviewdog reporter' default: 'textlint' package_manager: - description: 'Package manager used in the repository' + description: 'Package manager used in the repository [npm,yarn,pnpm,bun]' default: 'npm' runs: using: 'composite' diff --git a/script.sh b/script.sh index 42dc587..5512849 100755 --- a/script.sh +++ b/script.sh @@ -11,6 +11,8 @@ echo '::group::🐶 Installing reviewdog ... https://github.com/reviewdog/review curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b "${TEMP_PATH}" "${REVIEWDOG_VERSION}" 2>&1 echo '::endgroup::' +PACKAGE_EXECUTER=npx + echo '::group:: Installing textlint ... https://github.com/textlint/textlint' if [ -x "./node_modules/.bin/textlint" ]; then echo 'already installed' @@ -23,6 +25,10 @@ elif [[ "${INPUT_PACKAGE_MANAGER}" == "yarn" ]]; then elif [[ "${INPUT_PACKAGE_MANAGER}" == "pnpm" ]]; then echo 'pnpm install start' pnpm install +elif [[ "${INPUT_PACKAGE_MANAGER}" == "bun" ]]; then + echo 'bun install start' + bun install + PACKAGE_EXECUTER=bunx else echo 'The specified package manager is not supported.' echo '::endgroup::' @@ -30,7 +36,7 @@ else fi if [ -x "./node_modules/.bin/textlint" ]; then - npx textlint --version + $PACKAGE_EXECUTER textlint --version else echo 'This repository was not configured for textlint, process done.' exit 1 @@ -47,7 +53,7 @@ reviewdog_exit_val="0" reviewdog_exit_val2="0" # shellcheck disable=SC2086 -textlint_check_output=$(npx textlint -f checkstyle ${INPUT_TEXTLINT_FLAGS} 2>&1) \ +textlint_check_output=$(${PACKAGE_EXECUTER} textlint -f checkstyle ${INPUT_TEXTLINT_FLAGS} 2>&1) \ || textlint_exit_val="$?" # shellcheck disable=SC2086 @@ -64,7 +70,7 @@ echo '::endgroup::' if [[ "${INPUT_REPORTER}" == "github-pr-review" ]]; then echo '::group:: Running textlint fixing report 🐶 ...' # fix - npx textlint --fix ${INPUT_TEXTLINT_FLAGS:-.} || true + $PACKAGE_EXECUTER textlint --fix ${INPUT_TEXTLINT_FLAGS:-.} || true TMPFILE=$(mktemp) git diff > "${TMPFILE}"