Add mandatory approval gate before posting PR comments #97
Workflow file for this run
This file contains hidden or 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: 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```' | |
| }) |