Skip to content

publish: devtools-git-config #28

publish: devtools-git-config

publish: devtools-git-config #28

Workflow file for this run

## @(#) : reviewdog / lint new articles
#
# @version 1.0.0
# @author Furukawa Atsushi <atsushifx@gmail.com>
# @date 2025-02-05
# @license MIT
#
# @desc<<
#
# lint new articles on GitHub
#
#<<
name: reviewdog
# PR及び手動でAction実行
on:
pull_request:
branches: [main]
paths:
- '**/*.md'
workflow_dispatch:
# 実行するAction
jobs:
lint-on-github:
name: lint on github
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: fetch main repository
run: |
git fetch origin main
- name: get changed files
id: changed
run: |
head_sha="$(git rev-parse HEAD)"
base_sha="$(git rev-parse origin/main)"
echo "head: ${head_sha}"
echo "base: ${base_sha}"
files=$(git diff --name-only ${base_sha} ${head_sha} -- '**/*.md')
echo "changed: ${files}"
echo "files=${files}" >> $GITHUB_OUTPUT
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 22
- name: restore cache
id: cache-restore
uses: actions/cache/restore@v4
with:
key: ${{ runner.os }}-cache
path: |
node_modules
~/.npm
.textlintcache
- name: install node modules
if: ${{ steps.cache-restore.outputs.cache-hit != 'true' }}
run: |
npm install --no-audit --save-prod --progress=false --silent \
textlint \
textlint-filter-rule-allowlist textlint-filter-rule-comments \
textlint-rule-preset-ja-technical-writing textlint-rule-preset-ja-spacing \
textlint-rule-ja-no-orthographic-variants \
@textlint-ja/textlint-rule-no-synonyms sudachi-synonyms-dictionary \
@textlint-ja/textlint-rule-morpheme-match \
textlint-rule-ja-hiraku \
textlint-rule-no-mixed-zenkaku-and-hankaku-alphabet \
textlint-rule-common-misspellings \
@proofdict/textlint-rule-proofdict \
textlint-rule-prh \
markdownlint-cli2
# npm list
- name: lint text
if: ${{ steps.changed.outputs.files != '' }}
env:
changed_files: "${{ steps.changed.outputs.files }}"
run: |
npm run lint:docs -- "${changed_files}"
- name: lint markdown
if: ${{ steps.changed.outputs.files != '' }}
env:
changed_files: "${{ steps.changed.outputs.files }}"
run: |
npm run lint:markdown -- ${changed_files}
- name: Always save cache
id: cache-save
uses: actions/cache/save@v4
with:
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
path: |
node_modules
~/.npm
.textlintcache