├── .github ├── renovate.json └── workflows │ ├── depup.yml │ ├── dockerimage.yml │ ├── release.yml │ ├── reviewdog.yml │ └── update_semver.yml ├── Dockerfile ├── LICENSE ├── README.md ├── action.yml ├── entrypoint.sh └── testdata └── text.md /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:base" 4 | ], 5 | "labels": [ 6 | "bump:patch" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /.github/workflows/depup.yml: -------------------------------------------------------------------------------- 1 | name: depup 2 | on: 3 | schedule: 4 | - cron: '14 14 * * *' # Runs at 14:14 UTC every day 5 | repository_dispatch: 6 | types: [depup] 7 | 8 | jobs: 9 | reviewdog: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 13 | - uses: haya14busa/action-depup@94a1aaf4e4923064019214b48a43276218af7ad5 # v1.6.4 14 | id: depup 15 | with: 16 | file: Dockerfile 17 | version_name: REVIEWDOG_VERSION 18 | repo: reviewdog/reviewdog 19 | 20 | - name: Create Pull Request 21 | uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 22 | with: 23 | token: ${{ secrets.GITHUB_TOKEN }} 24 | title: "chore(deps): update reviewdog to ${{ steps.depup.outputs.latest }}" 25 | commit-message: "chore(deps): update reviewdog to ${{ steps.depup.outputs.latest }}" 26 | body: | 27 | Update reviewdog to [v${{ steps.depup.outputs.latest }}](https://github.com/reviewdog/reviewdog/releases/tag/v${{ steps.depup.outputs.latest }}) 28 | Compare [v${{ steps.depup.outputs.current }}...v${{ steps.depup.outputs.latest }}](https://github.com/reviewdog/reviewdog/compare/v${{ steps.depup.outputs.current }}...v${{ steps.depup.outputs.latest }}) 29 | 30 | This PR is auto generated by [depup workflow](https://github.com/${{ github.repository }}/actions?query=workflow%3Adepup). 31 | branch: depup/reviewdog 32 | base: master 33 | labels: "bump:minor" 34 | -------------------------------------------------------------------------------- /.github/workflows/dockerimage.yml: -------------------------------------------------------------------------------- 1 | name: Docker Image CI 2 | 3 | on: [push] 4 | 5 | jobs: 6 | 7 | build: 8 | 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 13 | - name: Build the Docker image 14 | run: docker build . --file Dockerfile --tag reviewdog-misspell:$(date +%s) 15 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: release 2 | on: 3 | push: 4 | branches: 5 | - master 6 | tags: 7 | - 'v*.*.*' 8 | pull_request: 9 | types: 10 | - labeled 11 | 12 | jobs: 13 | release: 14 | if: github.event.action != 'labeled' 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 18 | 19 | # Bump version on merging Pull Requests with specific labels. 20 | # (bump:major,bump:minor,bump:patch) 21 | - id: bumpr 22 | if: "!startsWith(github.ref, 'refs/tags/')" 23 | uses: haya14busa/action-bumpr@78ab5a104d20896c9c9122c64221b3aecf1a8cbb # v1.10.0 24 | 25 | # Update corresponding major and minor tag. 26 | # e.g. Update v1 and v1.2 when releasing v1.2.3 27 | - uses: haya14busa/action-update-semver@fb48464b2438ae82cc78237be61afb4f461265a1 # v1.2.1 28 | if: "!steps.bumpr.outputs.skip" 29 | with: 30 | tag: ${{ steps.bumpr.outputs.next_version }} 31 | 32 | # Get tag name. 33 | - id: tag 34 | uses: haya14busa/action-cond@94f77f7a80cd666cb3155084e428254fea4281fd # v1.2.1 35 | with: 36 | cond: "${{ startsWith(github.ref, 'refs/tags/') }}" 37 | if_true: ${{ github.ref }} 38 | if_false: ${{ steps.bumpr.outputs.next_version }} 39 | 40 | # Create release 41 | - if: "steps.tag.outputs.value != ''" 42 | env: 43 | TAG_NAME: ${{ steps.tag.outputs.value }} 44 | CURRENT: ${{ steps.bumpr.outputs.current_version }} 45 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 46 | run: | 47 | gh release create "${TAG_NAME}" -t "Release ${TAG_NAME/refs\/tags\//}" --generate-notes --notes-start-tag "${CURRENT}" 48 | 49 | release-check: 50 | if: github.event.action == 'labeled' 51 | runs-on: ubuntu-latest 52 | steps: 53 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 54 | - name: Post bumpr status comment 55 | uses: haya14busa/action-bumpr@78ab5a104d20896c9c9122c64221b3aecf1a8cbb # v1.10.0 56 | -------------------------------------------------------------------------------- /.github/workflows/reviewdog.yml: -------------------------------------------------------------------------------- 1 | name: reviewdog 2 | on: [pull_request] 3 | jobs: 4 | misspell: 5 | name: runner / misspell 6 | runs-on: ubuntu-latest 7 | steps: 8 | - name: Check out code. 9 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 10 | - name: misspell 11 | uses: ./ 12 | with: 13 | github_token: ${{ secrets.github_token }} 14 | locale: "US" 15 | pattern: "*.md" 16 | -------------------------------------------------------------------------------- /.github/workflows/update_semver.yml: -------------------------------------------------------------------------------- 1 | name: Update Semver 2 | on: 3 | push: 4 | branches-ignore: 5 | - '**' 6 | tags: 7 | - 'v*.*.*' 8 | jobs: 9 | update-semver: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 13 | - uses: haya14busa/action-update-semver@fb48464b2438ae82cc78237be61afb4f461265a1 # v1.2.1 14 | with: 15 | github_token: ${{ secrets.github_token }} 16 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye-slim 2 | 3 | ENV REVIEWDOG_VERSION=v0.20.3 4 | 5 | RUN apt-get update \ 6 | && apt-get install -y --no-install-recommends \ 7 | ca-certificates \ 8 | git \ 9 | wget \ 10 | && apt-get clean \ 11 | && rm -rf /var/lib/apt/lists/* 12 | 13 | RUN wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/fd59714416d6d9a1c0692d872e38e7f8448df4fc/install.sh| sh -s -- -b /usr/local/bin/ ${REVIEWDOG_VERSION} 14 | RUN wget -O - -q https://raw.githubusercontent.com/golangci/misspell/master/install-misspell.sh | sh -s -- -b /usr/local/bin/ 15 | 16 | COPY entrypoint.sh /entrypoint.sh 17 | 18 | ENTRYPOINT ["/entrypoint.sh"] 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 haya14busa 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GitHub Action: Run misspell with reviewdog 2 | 3 | [![Docker Image CI](https://github.com/reviewdog/action-misspell/workflows/Docker%20Image%20CI/badge.svg)](https://github.com/reviewdog/action-misspell/actions) 4 | [![depup](https://github.com/reviewdog/action-misspell/workflows/depup/badge.svg)](https://github.com/reviewdog/action-misspell/actions?query=workflow%3Adepup) 5 | [![release](https://github.com/reviewdog/action-misspell/workflows/release/badge.svg)](https://github.com/reviewdog/action-misspell/actions?query=workflow%3Arelease) 6 | [![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/reviewdog/action-misspell?logo=github&sort=semver)](https://github.com/reviewdog/action-misspell/releases) 7 | [![action-bumpr supported](https://img.shields.io/badge/bumpr-supported-ff69b4?logo=github&link=https://github.com/haya14busa/action-bumpr)](https://github.com/haya14busa/action-bumpr) 8 | 9 | This action runs [misspell](https://github.com/golangci/misspell) with 10 | [reviewdog](https://github.com/reviewdog/reviewdog) on pull requests to improve 11 | code review experience. 12 | 13 | [![sample annotation](https://user-images.githubusercontent.com/3797062/64926127-b8b0bc00-d834-11e9-97d5-5b6aa06dc573.png)](https://github.com/reviewdog/action-misspell/pull/1/files) 14 | 15 | ## Inputs 16 | 17 | ### `github_token` 18 | 19 | Optional. `${{ github.token }}` is used by default. 20 | 21 | ### `locale` 22 | 23 | Optional. -locale flag of misspell. [`US`/`UK`] 24 | 25 | ### `level` 26 | 27 | Optional. Report level for **reviewdog** [`info`,`warning`,`error`]. 28 | It's the same as the `-level` flag of **reviewdog**. 29 | 30 | ### `reporter` 31 | 32 | Optional. Reporter for **reviewdog** command [`github-pr-check`,`github-pr-review`]. 33 | It's the same as the `-reporter` flag of reviewdog. 34 | 35 | ### `ignore` 36 | 37 | Optional. Ignore (`-i`) a list of comma-separated words. [`armor`] / [`armor,color`]. 38 | 39 | ### `path` 40 | 41 | Optional. Base directory to run misspell. Same as `[path]` of `find` command. Default: `.` 42 | 43 | Directories are separated by lines. e.g.: 44 | ```yml 45 | path: | 46 | doc 47 | src 48 | ``` 49 | 50 | ### `pattern` 51 | 52 | Optional. File patterns of target files. Same as `-name [pattern]` of `find` command. Default: `*` 53 | 54 | Patterns are separated by lines. e.g.: 55 | ```yml 56 | pattern: | 57 | *.py 58 | *.sh 59 | ``` 60 | 61 | ### `exclude` 62 | 63 | Optional. Exclude patterns of target files. Same as `-not -path [exclude]` of `find` command. 64 | e.g. `./.git/*` 65 | 66 | Patterns are separated by lines. e.g.: 67 | ```yml 68 | exclude: | 69 | ./.git/* 70 | ./.cache/* 71 | ``` 72 | 73 | ### `filter_mode` 74 | 75 | Optional. Filtering mode for the reviewdog command [`added`,`diff_context`,`file`,`nofilter`]. Default: `added`. 76 | 77 | ### `fail_level` 78 | 79 | Optional. If set to `none`, always use exit code 0 for reviewdog. 80 | Otherwise, exit code 1 for reviewdog if it finds at least 1 issue with severity greater than or equal to the given level. 81 | Possible values: [`none`, `any`, `info`, `warning`, `error`] 82 | Default is `none`. 83 | 84 | ### `fail_on_error` 85 | 86 | Deprecated, use `fail_level` instead. 87 | Optional. Exit code for reviewdog when errors are found [`true`,`false`]. Default: `false`. 88 | 89 | ## Example usage 90 | 91 | ### [.github/workflows/reviewdog.yml](.github/workflows/reviewdog.yml) 92 | 93 | ```yml 94 | name: reviewdog 95 | on: [pull_request] 96 | jobs: 97 | misspell: 98 | name: runner / misspell 99 | runs-on: ubuntu-latest 100 | steps: 101 | - name: Check out code. 102 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 103 | - name: misspell 104 | uses: reviewdog/action-misspell@9daa94af4357dddb6fd3775de806bc0a8e98d3e4 # v1.26.3 105 | with: 106 | github_token: ${{ secrets.github_token }} 107 | locale: "US" 108 | ``` 109 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'Run misspell with reviewdog' 2 | description: '🐶 Run misspell with reviewdog on pull requests to improve code review experience.' 3 | author: 'haya14busa (reviewdog)' 4 | inputs: 5 | github_token: 6 | description: 'GITHUB_TOKEN.' 7 | default: '${{ github.token }}' 8 | locale: 9 | description: '-locale flag of misspell. (US/UK)' 10 | default: '' 11 | level: 12 | description: 'Report level for reviewdog [info,warning,error]' 13 | default: 'error' 14 | reporter: 15 | description: 'Reporter of reviewdog command [github-pr-check,github-pr-review].' 16 | default: 'github-pr-check' 17 | ignore: 18 | description: 'Comma-separated words to ignore' 19 | default: '' 20 | path: 21 | description: "Base directory to run misspell. Same as `[path]` of `find` command." 22 | default: '.' 23 | pattern: 24 | description: "File patterns of target files. Same as `-name [pattern]` of `find` command." 25 | default: '*' 26 | exclude: 27 | description: "Exclude patterns of target files. Same as `-not -path [exclude]` of `find` command." 28 | default: '' 29 | filter_mode: 30 | description: "Filtering mode for the reviewdog command [added,diff_context,file,nofilter]." 31 | default: 'added' 32 | fail_level: 33 | description: | 34 | If set to `none`, always use exit code 0 for reviewdog. 35 | Otherwise, exit code 1 for reviewdog if it finds at least 1 issue with severity greater than or equal to the given level. 36 | Possible values: [none,any,info,warning,error] 37 | Default is `none`. 38 | default: 'none' 39 | fail_on_error: 40 | description: "Deprecated, use `fail_level` instead. Exit code for reviewdog when errors are found [true,false]." 41 | deprecationMessage: Deprecated, use `fail_level` instead. 42 | default: 'false' 43 | runs: 44 | using: 'docker' 45 | image: 'Dockerfile' 46 | branding: 47 | icon: 'edit' 48 | color: 'gray-dark' 49 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd "${GITHUB_WORKSPACE}" || exit 1 4 | 5 | git config --global --add safe.directory $GITHUB_WORKSPACE || exit 1 6 | 7 | export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}" 8 | 9 | paths=() 10 | while read -r pattern; do 11 | [[ -n ${pattern} ]] && paths+=("${pattern}") 12 | done <<< "${INPUT_PATH:-.}" 13 | 14 | names=() 15 | if [[ "${INPUT_PATTERN:-*}" != '*' ]]; then 16 | while read -r pattern; do 17 | [[ -n ${pattern} ]] && names+=(-o -name "${pattern}") 18 | done <<< "${INPUT_PATTERN}" 19 | (( ${#names[@]} )) && { names[0]='('; names+=(')'); } 20 | fi 21 | 22 | excludes=() 23 | while read -r pattern; do 24 | [[ -n ${pattern} ]] && excludes+=(-not -path "${pattern}") 25 | done <<< "${INPUT_EXCLUDE:-}" 26 | 27 | find "${paths[@]}" "${excludes[@]}" -type f "${names[@]}" -print0 \ 28 | | xargs -0 misspell -locale="${INPUT_LOCALE}" -i "${INPUT_IGNORE}" \ 29 | | reviewdog -efm="%f:%l:%c: %m" \ 30 | -filter-mode="${INPUT_FILTER_MODE:-added}" \ 31 | -name="misspell" \ 32 | -reporter="${INPUT_REPORTER:-github-pr-check}" \ 33 | -level="${INPUT_LEVEL}" \ 34 | -fail-level="${INPUT_FAIL_LEVEL}" \ 35 | -fail-on-error="${INPUT_FAIL_ON_ERROR}" 36 | exit_code=$? 37 | 38 | exit $exit_code 39 | -------------------------------------------------------------------------------- /testdata/text.md: -------------------------------------------------------------------------------- 1 | Determinisitic result is important. 2 | 3 | colour # <= Check -locale 4 | --------------------------------------------------------------------------------