Skip to content

Commit acab4b7

Browse files
authored
Add bun support (#481)
Add bun support
1 parent be767b5 commit acab4b7

File tree

4 files changed

+39
-8
lines changed

4 files changed

+39
-8
lines changed

Diff for: .github/workflows/test.yml

+28-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525

2626
test-pr-check-npm:
2727
if: github.event_name == 'pull_request'
28-
name: runner / textlint (github-pr-check)
28+
name: runner / textlint (github-pr-check, npm)
2929
runs-on: ubuntu-latest
3030
steps:
3131
- name: Checkout
@@ -46,7 +46,7 @@ jobs:
4646

4747
test-pr-check-yarn:
4848
if: github.event_name == 'pull_request'
49-
name: runner / textlint (github-pr-check)
49+
name: runner / textlint (github-pr-check, yarn)
5050
runs-on: ubuntu-latest
5151
steps:
5252
- name: Checkout
@@ -67,7 +67,7 @@ jobs:
6767

6868
test-pr-check-pnpm:
6969
if: github.event_name == 'pull_request'
70-
name: runner / textlint (github-pr-check)
70+
name: runner / textlint (github-pr-check, pnpm)
7171
runs-on: ubuntu-latest
7272
steps:
7373
- name: Checkout
@@ -90,6 +90,31 @@ jobs:
9090
reporter: github-pr-check
9191
textlint_flags: "doc/**"
9292

93+
test-pr-check-bun:
94+
if: github.event_name == 'pull_request'
95+
name: runner / textlint (github-pr-check, bun)
96+
runs-on: ubuntu-latest
97+
steps:
98+
- name: Checkout
99+
uses: actions/checkout@v4
100+
with:
101+
submodules: true
102+
- name: Setup node
103+
uses: actions/setup-node@v1
104+
with:
105+
node-version: 20
106+
- name: Setup bun
107+
uses: oven-sh/setup-bun@v2
108+
with:
109+
bun-version: latest
110+
- name: textlint-github-check
111+
uses: ./
112+
with:
113+
github_token: ${{ secrets.github_token }}
114+
package_manager: bun
115+
reporter: github-pr-check
116+
textlint_flags: "doc/**"
117+
93118
test-pr-review:
94119
if: github.event_name == 'pull_request'
95120
name: runner / textlint (github-pr-review)

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ textlint arguments (i.e. target dir:`doc/*`)
6464

6565
### `package_manager`
6666

67-
Optional. Package manager used in the repository [npm,yarn,pnpm]
67+
Optional. Package manager used in the repository [npm,yarn,pnpm,bun]
6868
Default is `npm`.
6969

7070
## Customizes

Diff for: action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ inputs:
3636
description: 'Tool name to use for reviewdog reporter'
3737
default: 'textlint'
3838
package_manager:
39-
description: 'Package manager used in the repository'
39+
description: 'Package manager used in the repository [npm,yarn,pnpm,bun]'
4040
default: 'npm'
4141
runs:
4242
using: 'composite'

Diff for: script.sh

+9-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ echo '::group::🐶 Installing reviewdog ... https://github.com/reviewdog/review
1111
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b "${TEMP_PATH}" "${REVIEWDOG_VERSION}" 2>&1
1212
echo '::endgroup::'
1313

14+
PACKAGE_EXECUTER=npx
15+
1416
echo '::group:: Installing textlint ... https://github.com/textlint/textlint'
1517
if [ -x "./node_modules/.bin/textlint" ]; then
1618
echo 'already installed'
@@ -23,14 +25,18 @@ elif [[ "${INPUT_PACKAGE_MANAGER}" == "yarn" ]]; then
2325
elif [[ "${INPUT_PACKAGE_MANAGER}" == "pnpm" ]]; then
2426
echo 'pnpm install start'
2527
pnpm install
28+
elif [[ "${INPUT_PACKAGE_MANAGER}" == "bun" ]]; then
29+
echo 'bun install start'
30+
bun install
31+
PACKAGE_EXECUTER=bunx
2632
else
2733
echo 'The specified package manager is not supported.'
2834
echo '::endgroup::'
2935
exit 1
3036
fi
3137

3238
if [ -x "./node_modules/.bin/textlint" ]; then
33-
npx textlint --version
39+
$PACKAGE_EXECUTER textlint --version
3440
else
3541
echo 'This repository was not configured for textlint, process done.'
3642
exit 1
@@ -47,7 +53,7 @@ reviewdog_exit_val="0"
4753
reviewdog_exit_val2="0"
4854

4955
# shellcheck disable=SC2086
50-
textlint_check_output=$(npx textlint -f checkstyle ${INPUT_TEXTLINT_FLAGS} 2>&1) \
56+
textlint_check_output=$(${PACKAGE_EXECUTER} textlint -f checkstyle ${INPUT_TEXTLINT_FLAGS} 2>&1) \
5157
|| textlint_exit_val="$?"
5258

5359
# shellcheck disable=SC2086
@@ -64,7 +70,7 @@ echo '::endgroup::'
6470
if [[ "${INPUT_REPORTER}" == "github-pr-review" ]]; then
6571
echo '::group:: Running textlint fixing report 🐶 ...'
6672
# fix
67-
npx textlint --fix ${INPUT_TEXTLINT_FLAGS:-.} || true
73+
$PACKAGE_EXECUTER textlint --fix ${INPUT_TEXTLINT_FLAGS:-.} || true
6874

6975
TMPFILE=$(mktemp)
7076
git diff > "${TMPFILE}"

0 commit comments

Comments
 (0)