『読み手につたわる文章 - テクニカルライティング』を読んだ を書いた #10
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: run-textlint | |
on: | |
pull_request: | |
jobs: | |
run-textlint: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Switch to pull request branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup node with cache | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
- name: Install packages via packages.json | |
run: npm install | |
- name: Run textlint (avoiding error) | |
run: npx textlint ./contents/**/*.md -o ./.textlint.log | true | |
shell: bash {0} | |
- name: Report if textlint finds problems | |
run: | | |
if [ -e ./.textlint.log ]; then | |
# create body file | |
pwd_esc=$(pwd | sed 's/\//\\\//g') | |
cat ./.textlint.log | sed "s/${pwd_esc}/### :eyes: ./g" >> ./.body.txt | |
# pr comment | |
gh pr comment --body-file ./.body.txt "${URL}" | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
URL: ${{ github.event.pull_request.html_url }} |