Skip to content

Add mandatory approval gate before posting PR comments #97

Add mandatory approval gate before posting PR comments

Add mandatory approval gate before posting PR comments #97

Workflow file for this run

name: Textlint
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- '**.md'
- 'package.json'
- 'package-lock.json'
jobs:
textlint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run textlint
run: npm run textlint
- name: Comment PR on failure
if: failure()
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: ':warning: Textlint検査で問題が検出されました。詳細はActionsログを確認してください。\n\nローカルで修正するには:\n```bash\nnpm install\nnpm run textlint\nnpm run textlint:fix # 自動修正を試みる\n```'
})