reviewdogを使っているときにハマったときのメモ
name: ESLint
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
eslint:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
defaults:
run:
working-directory: my-vue-app
steps:
- uses: actions/checkout@v4
- uses: reviewdog/action-eslint@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-check
eslint_flags: "src/"
公式にならって以上の通りに書いてました。
Run reviewdog/action-eslint@v1
Run $GITHUB_ACTION_PATH/script.sh
🐶 Installing reviewdog ... https://github.com/reviewdog/reviewdog
sh: 1: eslint: not found
Running `npm install` to install eslint ...
sh: 1: eslint: not found
eslint version:
Running eslint with reviewdog 🐶 ...
Error: Process completed with exit code 1.
なぜか落ちる
.
├── .github
└── workflow
└── ESLint.yml
└── my-vue-app
└── src
└── package.json
└── ...
ディレクトリ構成は以上の通り
原因
- 公式に二通りあり、プロジェクト直下じゃないと上記では動かない?
- src直下に辿り着いていない?
修正
name: ESLint
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
eslint:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
defaults:
run:
working-directory: my-vue-app
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "20"
- run: npm install
- uses: reviewdog/action-eslint@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-check
eslint_flags: "src/"
+ workdir: my-vue-app
注意してほしいのが、defaluts
部にworking-directoryを指定してもreviewdogにworkdirを割り当てる必要があります。(自分の環境だけかも)
Run reviewdog/action-eslint@v1
Run $GITHUB_ACTION_PATH/script.sh
🐶 Installing reviewdog ... https://github.com/reviewdog/reviewdog
v8.57.0
eslint version:v8.57.0
Running eslint with reviewdog 🐶 ...
reviewdog: Reporting results for "eslint"
reviewdog: No results found for "eslint". 0 results found outside diff.
よきlintライフを