Qiitaから記事をインポートする #20
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "日本語のlintをかける" | |
on: | |
pull_request: | |
paths: | |
- contents/*.md | |
- README.md | |
jobs: | |
textlint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "checkoutする" | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: "fetchする" | |
run: git fetch | |
- name: "Node.jsのセットアップ" | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: "pnpmのセットアップ" | |
uses: pnpm/action-setup@v3 | |
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@v4 | |
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: "textlintの実行 with reviewdog" | |
run: | | |
npx textlint -f checkstyle $(git diff --name-only origin/main HEAD | grep -E '\.md$' | sed -z "s/\n/ /g") | reviewdog -f checkstyle --name=textlint -reporter=github-pr-review | |
env: | |
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |