├── doc └── .gitkeep ├── .gitignore ├── .github ├── auto_assign-issues.yml ├── semantic.yml ├── renovate.json ├── weekly-digest.yml └── workflows │ ├── release-check.yml │ ├── update_semver.yml │ ├── depup.yml │ ├── release.yml │ ├── reviewdog.yml │ └── test.yml ├── .gitmodules ├── .markdownlintrc ├── prh.yml ├── .editorconfig ├── .gitattributes ├── .textlintrc ├── package.json ├── action.yml ├── script.sh ├── README.md └── LICENSE.md /doc/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | -------------------------------------------------------------------------------- /.github/auto_assign-issues.yml: -------------------------------------------------------------------------------- 1 | addAssignees: true 2 | assignees: 3 | - tsuyoshicho 4 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "prh-rules"] 2 | path = prh-rules 3 | url = https://github.com/prh/rules.git 4 | -------------------------------------------------------------------------------- /.markdownlintrc: -------------------------------------------------------------------------------- 1 | { 2 | "default": true, 3 | "single-title": false, 4 | "line-length": false, 5 | "whitespace": false 6 | } 7 | -------------------------------------------------------------------------------- /.github/semantic.yml: -------------------------------------------------------------------------------- 1 | titleOnly: true 2 | allowMergeCommits: true 3 | allowRevertCommits: true 4 | # see https://github.com/zeke/semantic-pull-requests 5 | -------------------------------------------------------------------------------- /prh.yml: -------------------------------------------------------------------------------- 1 | version: 1 2 | 3 | imports: 4 | - ./prh-rules/media/techbooster.yml 5 | - ./prh-rules/files/markdown.yml 6 | # - ./prh-rules/files/review.yml 7 | 8 | -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "local>tsuyoshicho/renovate-config" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /.github/weekly-digest.yml: -------------------------------------------------------------------------------- 1 | # Configuration for weekly-digest - https://github.com/apps/weekly-digest 2 | publishDay: sun 3 | canPublishIssues: true 4 | canPublishPullRequests: true 5 | canPublishContributors: true 6 | canPublishStargazers: true 7 | canPublishCommits: true 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | # All 4 | [*] 5 | # end_of_line = lf 6 | insert_final_newline = true 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | indent_style = space 10 | indent_size = 2 11 | 12 | # Extension 13 | [*.{vim,vital}] 14 | end_of_line = lf 15 | 16 | [*.sh] 17 | end_of_line = lf 18 | 19 | # File 20 | [Makefile] 21 | end_of_line = lf 22 | indent_style = tab 23 | 24 | # EOF 25 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # vim:fenc=utf-8 ff=unix 3 | 4 | # git system files 5 | .gitattributes eol=lf 6 | .gitmodules eol=lf 7 | # gitignore contains Icon^M <- CRLF end 8 | # skip autocrlf,diff enable -> not binary, set -text 9 | .gitignore -text 10 | 11 | 12 | # Extension 13 | *.vim text eol=lf 14 | *.vital text eol=lf 15 | *.sh text eol=lf 16 | 17 | # File 18 | Makefile text eol=lf 19 | 20 | # EOF 21 | -------------------------------------------------------------------------------- /.github/workflows/release-check.yml: -------------------------------------------------------------------------------- 1 | name: release check 2 | on: 3 | pull_request: 4 | types: 5 | - labeled 6 | permissions: 7 | contents: write 8 | 9 | jobs: 10 | release-check: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 15 | with: 16 | submodules: true 17 | 18 | - name: Post bumpr status comment 19 | uses: haya14busa/action-bumpr@faf6f474bcb6174125cfc569f0b2e24cbf03d496 # v1.11.4 20 | -------------------------------------------------------------------------------- /.github/workflows/update_semver.yml: -------------------------------------------------------------------------------- 1 | name: Update Semver 2 | on: 3 | push: 4 | branches-ignore: 5 | - '**' 6 | tags: 7 | - 'v*.*.*' 8 | permissions: 9 | contents: write 10 | 11 | jobs: 12 | update-semver: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 17 | with: 18 | submodules: true 19 | - name: Update semver 20 | uses: haya14busa/action-update-semver@7d2c558640ea49e798d46539536190aff8c18715 # v1.5.1 21 | -------------------------------------------------------------------------------- /.textlintrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": { 3 | "@textlint/markdown": { 4 | "extensions": [".md"] 5 | } 6 | }, 7 | "rules": { 8 | "spellcheck-tech-word": true, 9 | "prh": { 10 | "rulePaths": ["./prh.yml"] 11 | }, 12 | "preset-ja-technical-writing": { 13 | "max-ten": { 14 | "max": 3 15 | }, 16 | "no-mix-dearu-desumasu": true, 17 | "ja-no-abusage": true, 18 | "ja-no-redundant-expression": true, 19 | "no-unmatched-pair": true, 20 | "no-double-negative-ja": true, 21 | "no-doubled-conjunctive-particle-ga": true, 22 | } 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "action-textlint", 3 | "version": "1.0.0", 4 | "description": "textlint with reviewdog", 5 | "main": "index.js", 6 | "directories": { 7 | "doc": "doc" 8 | }, 9 | "scripts": { 10 | "test": "echo \"Error: no test specified\" && exit 1" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/tsuyoshicho/action-textlint.git" 15 | }, 16 | "keywords": [ 17 | "textlint", 18 | "markdown" 19 | ], 20 | "author": "tsuyoshi_cho ", 21 | "license": "SEE LICENSE IN LICENSE.md", 22 | "bugs": { 23 | "url": "https://github.com/tsuyoshicho/action-textlint/issues" 24 | }, 25 | "homepage": "https://github.com/tsuyoshicho/action-textlint#readme", 26 | "devDependencies": {}, 27 | "dependencies": { 28 | "textlint": "15.5.0", 29 | "textlint-rule-preset-ja-technical-writing": "12.0.2", 30 | "textlint-rule-prh": "6.1.0", 31 | "textlint-rule-spellcheck-tech-word": "5.0.0" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /.github/workflows/depup.yml: -------------------------------------------------------------------------------- 1 | name: depup 2 | on: 3 | schedule: 4 | - cron: '35 9 2,13,25 * *' # Runs at 9:35 UTC 2,13,25 per month 5 | repository_dispatch: 6 | types: [depup] 7 | workflow_dispatch: 8 | permissions: 9 | contents: write 10 | pull-requests: write 11 | 12 | jobs: 13 | reviewdog: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 18 | with: 19 | submodules: true 20 | 21 | - name: Check depup 22 | uses: haya14busa/action-depup@94a1aaf4e4923064019214b48a43276218af7ad5 # v1.6.4 23 | id: depup 24 | with: 25 | file: action.yml 26 | version_name: REVIEWDOG_VERSION 27 | repo: reviewdog/reviewdog 28 | 29 | - name: Create Pull Request 30 | uses: peter-evans/create-pull-request@98357b18bf14b5342f975ff684046ec3b2a07725 # v8.0.0 31 | with: 32 | token: ${{ secrets.GITHUB_TOKEN }} 33 | author: 'github-actions <41898282+github-actions[bot]@users.noreply.github.com>' 34 | title: "chore(deps): update ${{ steps.depup.outputs.repo }} to ${{ steps.depup.outputs.latest }}" 35 | commit-message: "chore(deps): update ${{ steps.depup.outputs.repo }} to ${{ steps.depup.outputs.latest }}" 36 | body: | 37 | Update ${{ steps.depup.outputs.repo }} to [${{ steps.depup.outputs.latest }}](https://github.com/${{ steps.depup.outputs.repo }}/releases/tag/v${{ steps.depup.outputs.latest }}) 38 | 39 | This PR is auto generated by [depup workflow](https://github.com/${{ github.repository }}/actions?query=workflow%3A${{ github.workflow }}). 40 | branch: depup/${{ steps.depup.outputs.repo }} 41 | labels: "bump:minor" 42 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: release 2 | on: 3 | push: 4 | branches: 5 | - master 6 | tags: 7 | - 'v*.*.*' 8 | permissions: 9 | contents: write 10 | 11 | jobs: 12 | release: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 17 | with: 18 | submodules: true 19 | 20 | # Bump version on merging Pull Requests with specific labels. 21 | # (bump:major,bump:minor,bump:patch) 22 | - name: Bump version 23 | id: bumpr 24 | if: "!startsWith(github.ref, 'refs/tags/')" 25 | uses: haya14busa/action-bumpr@faf6f474bcb6174125cfc569f0b2e24cbf03d496 # v1.11.4 26 | 27 | # Update corresponding major and minor tag. 28 | # e.g. Update v1 and v1.2 when releasing v1.2.3 29 | - name: Update semver 30 | uses: haya14busa/action-update-semver@7d2c558640ea49e798d46539536190aff8c18715 # v1.5.1 31 | if: "!steps.bumpr.outputs.skip" 32 | with: 33 | tag: ${{ steps.bumpr.outputs.next_version }} 34 | 35 | # Get tag name. 36 | - name: Tag check 37 | id: tag 38 | uses: haya14busa/action-cond@94f77f7a80cd666cb3155084e428254fea4281fd # v1.2.1 39 | with: 40 | cond: "${{ startsWith(github.ref, 'refs/tags/') }}" 41 | if_true: ${{ github.ref }} 42 | if_false: ${{ steps.bumpr.outputs.next_version }} 43 | 44 | # Create release. 45 | - name: Create release 46 | uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0 47 | if: "steps.tag.outputs.value != ''" 48 | with: 49 | token: ${{ secrets.GITHUB_TOKEN }} 50 | name: Release ${{ steps.tag.outputs.value }} 51 | body: ${{ steps.bumpr.outputs.message }} 52 | tag_name: ${{ steps.tag.outputs.value }} 53 | draft: false 54 | prerelease: false 55 | -------------------------------------------------------------------------------- /.github/workflows/reviewdog.yml: -------------------------------------------------------------------------------- 1 | name: reviewdog 2 | on: 3 | push: 4 | branches: 5 | - master 6 | pull_request: 7 | permissions: 8 | pull-requests: write 9 | 10 | jobs: 11 | shellcheck: 12 | name: runner / shellcheck 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 16 | - uses: haya14busa/action-cond@94f77f7a80cd666cb3155084e428254fea4281fd # v1.2.1 17 | id: reporter 18 | with: 19 | cond: ${{ github.event_name == 'pull_request' }} 20 | if_true: "github-pr-review" 21 | if_false: "github-check" 22 | - uses: reviewdog/action-shellcheck@4c07458293ac342d477251099501a718ae5ef86e # v1.32.0 23 | with: 24 | github_token: ${{ secrets.github_token }} 25 | reporter: ${{ steps.reporter.outputs.value }} 26 | level: warning 27 | 28 | # hadolint: 29 | # name: runner / hadolint 30 | # runs-on: ubuntu-latest 31 | # steps: 32 | # - uses: actions/checkout@v4.2.2 33 | # - uses: haya14busa/action-cond@v1.2.1 34 | # id: reporter 35 | # with: 36 | # cond: ${{ github.event_name == 'pull_request' }} 37 | # if_true: "github-pr-review" 38 | # if_false: "github-check" 39 | # - uses: reviewdog/action-hadolint@v1.50.2 40 | # with: 41 | # github_token: ${{ secrets.github_token }} 42 | # reporter: ${{ steps.reporter.outputs.value }} 43 | # level: warning 44 | 45 | misspell: 46 | name: runner / misspell 47 | runs-on: ubuntu-latest 48 | steps: 49 | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 50 | - uses: reviewdog/action-misspell@d6429416b12b09b4e2768307d53bef58d172e962 # v1.27.0 51 | with: 52 | github_token: ${{ secrets.github_token }} 53 | reporter: github-check 54 | level: warning 55 | locale: "US" 56 | 57 | alex: 58 | name: runner / alex 59 | runs-on: ubuntu-latest 60 | steps: 61 | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 62 | - uses: reviewdog/action-alex@6083b8ca333981fa617c6828c5d8fb21b13d916b # v1.16.0 63 | with: 64 | github_token: ${{ secrets.github_token }} 65 | reporter: github-check 66 | level: warning 67 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'Run textlint with reviewdog' 2 | description: '🐶Run textlint with reviewdog on pull requests to improve document writing experience.' 3 | author: 'Tsuyoshi CHO ' 4 | inputs: 5 | github_token: 6 | description: 'GITHUB_TOKEN.' 7 | required: true 8 | default: ${{ github.token }} 9 | level: 10 | description: 'Report level for reviewdog [info,warning,error]' 11 | default: 'error' 12 | reporter: 13 | description: | 14 | Reporter of reviewdog command [github-check,github-pr-review]. 15 | Default is github-pr-review. 16 | github-pr-review can use Markdown and add a link to rule page in reviewdog reports. 17 | default: 'github-pr-review' 18 | filter_mode: 19 | description: | 20 | Filtering mode for the reviewdog command [added,diff_context,file,nofilter]. 21 | Default is added. 22 | default: 'added' 23 | fail_level: 24 | description: | 25 | Optional. Exit code control for reviewdog, [none,any,info,warning,error] 26 | Default is `none`. 27 | default: 'none' 28 | fail_on_error: 29 | description: | 30 | Deprecated. 31 | 32 | Optional. Exit code for reviewdog when errors are found [true,false] 33 | Default is `false`. 34 | 35 | If `true` is set, it will be interpreted as "-fail-level=error". 36 | But if "-fail-level" is set non-`none`, it will be ignored. 37 | default: 'false' 38 | reviewdog_flags: 39 | description: 'Additional reviewdog flags' 40 | default: '' 41 | textlint_flags: 42 | description: "flags and args of textlint command. Default: '.'" 43 | required: true 44 | default: '.' 45 | tool_name: 46 | description: 'Tool name to use for reviewdog reporter' 47 | default: 'textlint' 48 | package_manager: 49 | description: 'Package manager used in the repository [npm,yarn,pnpm,bun]' 50 | default: 'npm' 51 | runs: 52 | using: 'composite' 53 | steps: 54 | - run: $GITHUB_ACTION_PATH/script.sh 55 | shell: sh 56 | env: 57 | REVIEWDOG_VERSION: v0.21.0 58 | # INPUT_ is not available in Composite run steps 59 | # https://github.community/t/input-variable-name-is-not-available-in-composite-run-steps/127611 60 | INPUT_GITHUB_TOKEN: ${{ inputs.github_token }} 61 | INPUT_LEVEL: ${{ inputs.level }} 62 | INPUT_REPORTER: ${{ inputs.reporter }} 63 | INPUT_FILTER_MODE: ${{ inputs.filter_mode }} 64 | INPUT_FAIL_LEVEL: ${{ inputs.fail_level }} 65 | INPUT_FAIL_ON_ERROR: ${{ inputs.fail_on_error }} 66 | INPUT_REVIEWDOG_FLAGS: ${{ inputs.reviewdog_flags }} 67 | INPUT_TEXTLINT_FLAGS: ${{ inputs.textlint_flags }} 68 | INPUT_TOOL_NAME: ${{ inputs.tool_name }} 69 | INPUT_PACKAGE_MANAGER: ${{ inputs.package_manager }} 70 | branding: 71 | icon: 'alert-octagon' 72 | color: 'blue' 73 | -------------------------------------------------------------------------------- /script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # shellcheck disable=SC2086,SC2089,SC2090 4 | 5 | cd "${GITHUB_WORKSPACE}" || exit 6 | 7 | TEMP_PATH="$(mktemp -d)" 8 | PATH="${TEMP_PATH}:$PATH" 9 | 10 | echo '::group::🐶 Installing reviewdog ... https://github.com/reviewdog/reviewdog' 11 | curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b "${TEMP_PATH}" "${REVIEWDOG_VERSION}" 2>&1 12 | echo '::endgroup::' 13 | 14 | PACKAGE_EXECUTER=npx 15 | 16 | echo '::group:: Installing textlint ... https://github.com/textlint/textlint' 17 | if [ -x "./node_modules/.bin/textlint" ]; then 18 | echo 'already installed' 19 | elif [[ "${INPUT_PACKAGE_MANAGER}" == "npm" ]]; then 20 | echo 'npm ci start' 21 | npm ci 22 | elif [[ "${INPUT_PACKAGE_MANAGER}" == "yarn" ]]; then 23 | echo 'yarn install start' 24 | yarn install 25 | elif [[ "${INPUT_PACKAGE_MANAGER}" == "pnpm" ]]; then 26 | echo 'pnpm install start' 27 | pnpm install 28 | elif [[ "${INPUT_PACKAGE_MANAGER}" == "bun" ]]; then 29 | echo 'bun install start' 30 | bun install 31 | PACKAGE_EXECUTER=bunx 32 | else 33 | echo 'The specified package manager is not supported.' 34 | echo '::endgroup::' 35 | exit 1 36 | fi 37 | 38 | if [ -x "./node_modules/.bin/textlint" ]; then 39 | $PACKAGE_EXECUTER textlint --version 40 | else 41 | echo 'This repository was not configured for textlint, process done.' 42 | exit 1 43 | fi 44 | echo '::endgroup::' 45 | 46 | export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}" 47 | 48 | 49 | echo '::group:: Running textlint with reviewdog 🐶 ...' 50 | textlint_exit_val="0" 51 | reviewdog_exit_val="0" 52 | # ignore preview exit code 53 | reviewdog_exit_val2="0" 54 | 55 | fail_level="${INPUT_FAIL_LEVEL}" 56 | if [[ "${INPUT_FAIL_LEVEL}" == "none" ]] && [[ "${INPUT_FAIL_ON_ERROR}" == "true" ]]; then 57 | fail_level="error" 58 | fi 59 | 60 | echo "report level is: ${INPUT_LEVEL}" 61 | echo "fail level is: ${fail_level}" 62 | 63 | # shellcheck disable=SC2086 64 | textlint_check_output=$(${PACKAGE_EXECUTER} textlint -f checkstyle ${INPUT_TEXTLINT_FLAGS} 2>&1) \ 65 | || textlint_exit_val="$?" 66 | 67 | # shellcheck disable=SC2086 68 | echo "${textlint_check_output}" | reviewdog -f=checkstyle \ 69 | -name="${INPUT_TOOL_NAME}" \ 70 | -reporter="${INPUT_REPORTER:-github-pr-review}" \ 71 | -filter-mode="${INPUT_FILTER_MODE}" \ 72 | -fail-level="${fail_level}" \ 73 | -level="${INPUT_LEVEL}" \ 74 | ${INPUT_REVIEWDOG_FLAGS} || reviewdog_exit_val="$?" 75 | echo '::endgroup::' 76 | 77 | # github-pr-review only diff adding 78 | if [[ "${INPUT_REPORTER}" == "github-pr-review" ]]; then 79 | echo '::group:: Running textlint fixing report 🐶 ...' 80 | # fix 81 | $PACKAGE_EXECUTER textlint --fix ${INPUT_TEXTLINT_FLAGS:-.} || true 82 | 83 | TMPFILE=$(mktemp) 84 | git diff > "${TMPFILE}" 85 | 86 | git stash -u 87 | 88 | # shellcheck disable=SC2086,SC2034 89 | reviewdog \ 90 | -f=diff \ 91 | -f.diff.strip=1 \ 92 | -name="${INPUT_TOOL_NAME}-fix" \ 93 | -reporter="github-pr-review" \ 94 | -filter-mode="${INPUT_FILTER_MODE}" \ 95 | -fail-level="${fail_level}" \ 96 | -level="${INPUT_LEVEL}" \ 97 | ${INPUT_REVIEWDOG_FLAGS} < "${TMPFILE}" \ 98 | || reviewdog_exit_val2="$?" 99 | 100 | git stash drop || true 101 | echo '::endgroup::' 102 | fi 103 | 104 | # Throw error if an error occurred 105 | # textlint exitcode: 0 success 1 lint error detect 2 fatal error 106 | if [[ "${textlint_exit_val}" == "2" ]] || [[ "${reviewdog_exit_val}" != "0" ]]; then 107 | exit 1 108 | fi 109 | 110 | # EOF 111 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | on: 3 | push: 4 | branches: 5 | - master 6 | pull_request: 7 | permissions: 8 | pull-requests: write 9 | 10 | jobs: 11 | test-check: 12 | name: runner / textlint (github-check) 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 17 | with: 18 | submodules: true 19 | - name: textlint-github-check 20 | uses: ./ 21 | with: 22 | github_token: ${{ secrets.github_token }} 23 | reporter: github-check 24 | textlint_flags: "doc/**" 25 | 26 | test-pr-check-npm: 27 | if: github.event_name == 'pull_request' 28 | name: runner / textlint (github-pr-check, npm) 29 | runs-on: ubuntu-latest 30 | steps: 31 | - name: Checkout 32 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 33 | with: 34 | submodules: true 35 | - name: Setup node 36 | uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 37 | with: 38 | node-version: 24 39 | - name: textlint-github-check 40 | uses: ./ 41 | with: 42 | github_token: ${{ secrets.github_token }} 43 | reporter: github-pr-check 44 | package_manager: npm 45 | textlint_flags: "doc/**" 46 | 47 | test-pr-check-yarn: 48 | if: github.event_name == 'pull_request' 49 | name: runner / textlint (github-pr-check, yarn) 50 | runs-on: ubuntu-latest 51 | steps: 52 | - name: Checkout 53 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 54 | with: 55 | submodules: true 56 | - name: Setup node 57 | uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 58 | with: 59 | node-version: 24 60 | - name: textlint-github-check 61 | uses: ./ 62 | with: 63 | github_token: ${{ secrets.github_token }} 64 | package_manager: yarn 65 | reporter: github-pr-check 66 | textlint_flags: "doc/**" 67 | 68 | test-pr-check-pnpm: 69 | if: github.event_name == 'pull_request' 70 | name: runner / textlint (github-pr-check, pnpm) 71 | runs-on: ubuntu-latest 72 | steps: 73 | - name: Checkout 74 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 75 | with: 76 | submodules: true 77 | - name: Setup node 78 | uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 79 | with: 80 | node-version: 24 81 | - name: Setup pnpm 82 | uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 83 | with: 84 | version: latest 85 | - name: textlint-github-check 86 | uses: ./ 87 | with: 88 | github_token: ${{ secrets.github_token }} 89 | package_manager: pnpm 90 | reporter: github-pr-check 91 | textlint_flags: "doc/**" 92 | 93 | test-pr-check-bun: 94 | if: github.event_name == 'pull_request' 95 | name: runner / textlint (github-pr-check, bun) 96 | runs-on: ubuntu-latest 97 | steps: 98 | - name: Checkout 99 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 100 | with: 101 | submodules: true 102 | - name: Setup node 103 | uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 104 | with: 105 | node-version: 24 106 | - name: Setup bun 107 | uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2 108 | with: 109 | bun-version: latest 110 | - name: textlint-github-check 111 | uses: ./ 112 | with: 113 | github_token: ${{ secrets.github_token }} 114 | package_manager: bun 115 | reporter: github-pr-check 116 | textlint_flags: "doc/**" 117 | 118 | test-pr-review: 119 | if: github.event_name == 'pull_request' 120 | name: runner / textlint (github-pr-review) 121 | runs-on: ubuntu-latest 122 | steps: 123 | - name: Checkout 124 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 125 | with: 126 | submodules: true 127 | - name: textlint-github-pr-review 128 | uses: ./ 129 | with: 130 | github_token: ${{ secrets.github_token }} 131 | reporter: github-pr-review 132 | textlint_flags: "doc/**" 133 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GitHub Action: Run textlint with reviewdog 2 | 3 | [![DeepWiki](https://img.shields.io/badge/DeepWiki-tsuyoshicho%2Faction--textlint-blue.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAyCAYAAAAnWDnqAAAAAXNSR0IArs4c6QAAA05JREFUaEPtmUtyEzEQhtWTQyQLHNak2AB7ZnyXZMEjXMGeK/AIi+QuHrMnbChYY7MIh8g01fJoopFb0uhhEqqcbWTp06/uv1saEDv4O3n3dV60RfP947Mm9/SQc0ICFQgzfc4CYZoTPAswgSJCCUJUnAAoRHOAUOcATwbmVLWdGoH//PB8mnKqScAhsD0kYP3j/Yt5LPQe2KvcXmGvRHcDnpxfL2zOYJ1mFwrryWTz0advv1Ut4CJgf5uhDuDj5eUcAUoahrdY/56ebRWeraTjMt/00Sh3UDtjgHtQNHwcRGOC98BJEAEymycmYcWwOprTgcB6VZ5JK5TAJ+fXGLBm3FDAmn6oPPjR4rKCAoJCal2eAiQp2x0vxTPB3ALO2CRkwmDy5WohzBDwSEFKRwPbknEggCPB/imwrycgxX2NzoMCHhPkDwqYMr9tRcP5qNrMZHkVnOjRMWwLCcr8ohBVb1OMjxLwGCvjTikrsBOiA6fNyCrm8V1rP93iVPpwaE+gO0SsWmPiXB+jikdf6SizrT5qKasx5j8ABbHpFTx+vFXp9EnYQmLx02h1QTTrl6eDqxLnGjporxl3NL3agEvXdT0WmEost648sQOYAeJS9Q7bfUVoMGnjo4AZdUMQku50McDcMWcBPvr0SzbTAFDfvJqwLzgxwATnCgnp4wDl6Aa+Ax283gghmj+vj7feE2KBBRMW3FzOpLOADl0Isb5587h/U4gGvkt5v60Z1VLG8BhYjbzRwyQZemwAd6cCR5/XFWLYZRIMpX39AR0tjaGGiGzLVyhse5C9RKC6ai42ppWPKiBagOvaYk8lO7DajerabOZP46Lby5wKjw1HCRx7p9sVMOWGzb/vA1hwiWc6jm3MvQDTogQkiqIhJV0nBQBTU+3okKCFDy9WwferkHjtxib7t3xIUQtHxnIwtx4mpg26/HfwVNVDb4oI9RHmx5WGelRVlrtiw43zboCLaxv46AZeB3IlTkwouebTr1y2NjSpHz68WNFjHvupy3q8TFn3Hos2IAk4Ju5dCo8B3wP7VPr/FGaKiG+T+v+TQqIrOqMTL1VdWV1DdmcbO8KXBz6esmYWYKPwDL5b5FA1a0hwapHiom0r/cKaoqr+27/XcrS5UwSMbQAAAABJRU5ErkJggg==)](https://deepwiki.com/tsuyoshicho/action-textlint) 4 | 5 | 6 | ## notice 7 | 8 | action-textlint use textlint within npm ecosystem. 9 | 10 | ## detail 11 | 12 | [![Release](https://github.com/tsuyoshicho/action-textlint/workflows/release/badge.svg)](https://github.com/tsuyoshicho/action-textlint/releases) 13 | 14 | This action runs [textlint](https://github.com/textlint/textlint) with 15 | [reviewdog](https://github.com/reviewdog/reviewdog) on pull requests to improve 16 | text review experience. 17 | 18 | based on [reviewdog/action-vint](https://github.com/reviewdog/action-vint) 19 | 20 | [![github-pr-check example](https://user-images.githubusercontent.com/96727/70858620-bdc2fb80-1f48-11ea-9c1a-b5abb5a6566a.png)](https://user-images.githubusercontent.com/96727/70858620-bdc2fb80-1f48-11ea-9c1a-b5abb5a6566a.png) 21 | [![github-pr-review example](https://user-images.githubusercontent.com/96727/70858610-a1bf5a00-1f48-11ea-84c4-7ee7392548e6.png)](https://user-images.githubusercontent.com/96727/70858610-a1bf5a00-1f48-11ea-84c4-7ee7392548e6.png) 22 | 23 | Notice: 24 | This action is `composition action`. It need `npm ci`. 25 | 26 | You accept below one: 27 | 28 | - Your workflow manually setup to run `npm ci`. 29 | - This action automatic run `npm ci`. 30 | 31 | ## Inputs 32 | 33 | ### `github_token` 34 | 35 | **Required**. Default is `${{ github.token }}`. 36 | 37 | ### `level` 38 | 39 | Optional. Report level for reviewdog [info,warning,error]. 40 | It's same as `-level` flag of reviewdog. 41 | 42 | ### `reporter` 43 | 44 | Reporter of reviewdog command [github-pr-check,github-check,github-pr-review]. 45 | Default is github-pr-review. 46 | It's same as `-reporter` flag of reviewdog. 47 | 48 | github-pr-review can use Markdown and add a link to rule page in reviewdog reports. 49 | 50 | ### `filter_mode` 51 | 52 | Optional. Filtering mode for the reviewdog command [added,diff_context,file,nofilter]. 53 | Default is added. 54 | 55 | ### `fail_level` 56 | 57 | Optional. Exit code control for reviewdog, [none,any,info,warning,error] 58 | Default is `none`. 59 | 60 | ### `fail_on_error` 61 | 62 | **Deprecated.** 63 | 64 | Optional. Exit code for reviewdog when errors are found [true,false] 65 | Default is `false`. 66 | 67 | If `true` is set, it will be interpreted as "-fail-level=error". 68 | But if "-fail-level" is set non-`none`, it will be ignored. 69 | 70 | ### `reviewdog_flags` 71 | 72 | Optional. Additional reviewdog flags 73 | 74 | ### `textlint_flags` 75 | 76 | textlint arguments (i.e. target dir:`doc/*`) 77 | 78 | ### `package_manager` 79 | 80 | Optional. Package manager used in the repository [npm,yarn,pnpm,bun] 81 | Default is `npm`. 82 | 83 | ## Customizes 84 | 85 | `.textlintrc` put in your repo. 86 | And need textlint included in project package.json . 87 | 88 | ## Example usage 89 | 90 | ### [.github/workflows/reviewdog.yml](.github/workflows/reviewdog.yml) 91 | 92 | ```yml 93 | name: reviewdog 94 | on: [pull_request] 95 | jobs: 96 | textlint: 97 | name: runner / textlint 98 | runs-on: ubuntu-latest 99 | steps: 100 | - name: Checkout 101 | uses: actions/checkout@v2 102 | with: 103 | submodules: true 104 | - name: Setup node/npm 105 | uses: actions/setup-node@v1 106 | with: 107 | node-version: '15' 108 | - name: textlint-github-pr-check 109 | uses: tsuyoshicho/action-textlint@v3 110 | with: 111 | github_token: ${{ secrets.github_token }} 112 | reporter: github-pr-check 113 | textlint_flags: "doc/**" 114 | - name: textlint-github-check 115 | uses: tsuyoshicho/action-textlint@v3 116 | with: 117 | github_token: ${{ secrets.github_token }} 118 | reporter: github-check 119 | textlint_flags: "doc/**" 120 | - name: textlint-github-pr-review 121 | uses: tsuyoshicho/action-textlint@v3 122 | with: 123 | github_token: ${{ secrets.github_token }} 124 | reporter: github-pr-review 125 | textlint_flags: "doc/**" 126 | ``` 127 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # Creative Commons CC0 1.0 Universal 2 | 3 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER. 4 | 5 | ### Statement of Purpose 6 | 7 | The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work"). 8 | 9 | Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others. 10 | 11 | For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights. 12 | 13 | 1. __Copyright and Related Rights.__ A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following: 14 | 15 | i. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work; 16 | 17 | ii. moral rights retained by the original author(s) and/or performer(s); 18 | 19 | iii. publicity and privacy rights pertaining to a person's image or likeness depicted in a Work; 20 | 21 | iv. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below; 22 | 23 | v. rights protecting the extraction, dissemination, use and reuse of data in a Work; 24 | 25 | vi. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and 26 | 27 | vii. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof. 28 | 29 | 2. __Waiver.__ To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose. 30 | 31 | 3. __Public License Fallback.__ Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose. 32 | 33 | 4. __Limitations and Disclaimers.__ 34 | 35 | a. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document. 36 | 37 | b. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law. 38 | 39 | c. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work. 40 | 41 | d. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work. 42 | --------------------------------------------------------------------------------