feat: 添加 markdown 语法及格式检查,添加 autoreview 工作流 #2
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: Format Auto Review | |
| on: | |
| pull_request: | |
| types: [opened, reopened, synchronize] | |
| paths: | |
| - '**/*.md' | |
| permissions: | |
| contents: read | |
| concurrency: ci-${{ github.workflow }}-${{ github.ref }} | |
| jobs: | |
| auto-review: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Setup reviewdog | |
| uses: reviewdog/[email protected] | |
| with: | |
| reviewdog_version: latest | |
| - name: Get changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@v46 | |
| with: | |
| files: '**/*.md' | |
| - name: Running autocorrect | |
| continue-on-error: true | |
| if: steps.changed-files.outputs.any_changed == 'true' | |
| env: | |
| REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.REVIEW_GITHUB_TOKEN }} | |
| run: | | |
| curl -sSL https://git.io/JcGER | sh | |
| autocorrect --lint --format rdjson ${{ steps.changed-files.outputs.all_changed_files }} | reviewdog -f=rdjson -level=warning -reporter=github-pr-check | |
| - name: Running markdownlint | |
| uses: reviewdog/[email protected] | |
| continue-on-error: true | |
| if: steps.changed-files.outputs.any_changed == 'true' | |
| with: | |
| github_token: ${{ secrets.REVIEW_GITHUB_TOKEN }} | |
| reporter: github-pr-check | |
| markdownlint_flags: ${{ steps.changed-files.outputs.all_changed_files }} | |
| level: warning | |
| # - name: Check punctuation | |
| # if: steps.changed-files.outputs.any_changed == 'true' | |
| # id: punctuation-check | |
| # env: | |
| # GITHUB_URL: ${{ github.event.pull_request.head.repo.clone_url }} | |
| # GITHUB_REF: ${{ github.event.pull_request.head.ref }} | |
| # run: | | |
| # python tools/punctuation_checker.py \ | |
| # "${{ steps.changed-files.outputs.all_changed_files }}" | |
| # - name: Comment PR | |
| # if: steps.changed-files.outputs.any_changed == 'true' | |
| # uses: thollander/actions-comment-pull-request@v3 | |
| # with: | |
| # file-path: results.txt | |
| # comment-tag: punctuation-check |