diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..8fda5c0 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,50 @@ +name: "next lintをかける" + +on: + pull_request: + paths: + - "**/*.ts" + - "**/*.tsx" + +jobs: + nextlint: + runs-on: ubuntu-latest + steps: + - name: "checkoutする" + uses: actions/checkout@v3 + + - name: "Node.jsのセットアップ" + uses: actions/setup-node@v3 + with: + node-version: 20 + - name: "pnpmのセットアップ" + uses: pnpm/action-setup@v2 + id: pnpm-install + with: + version: 8 + run_install: false + - name: "reviewdogのインストール" + uses: reviewdog/action-setup@v1 + with: + reviewdog_version: latest + + - name: "pnpmのパッケージ保存先を保持" + id: pnpm-cache + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + - name: "キャッシュを使う" + uses: actions/cache@v3 + id: pnpm-cache-node_modules + with: + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }} + - name: "パッケージのインストール" + run: pnpm install + + - name: "next lintの実行 with reviewdog" + run: | + pnpm run lint -f checkstyle | reviewdog -f checkstyle --name=nextlint -reporter=github-pr-review + env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.github/workflows/textlint.yaml b/.github/workflows/textlint.yaml index c31b41a..bfdecbb 100644 --- a/.github/workflows/textlint.yaml +++ b/.github/workflows/textlint.yaml @@ -13,7 +13,7 @@ jobs: - name: "checkoutする" uses: actions/checkout@v3 with: - fetch-depth: 2 + fetch-depth: 0 - name: "fetchする" run: git fetch @@ -43,7 +43,6 @@ jobs: with: path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: ${{ runner.os }}-node_modules- - name: "パッケージのインストール" run: pnpm install diff --git a/package.json b/package.json index 709cd9d..8edbbd3 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "dev": "next dev", "build": "next build", "start": "next start", - "lint": "next lint", + "lint": "eslint -f stylish ./modules ./app", "format": "prettier --write --ignore-path .gitignore './**/*.{js,jsx,ts,tsx,json}'" }, "keywords": [],