Skip to content

🐶 Suggests any code changes based on diff through GitHub Multi-line code suggestions by using reviewdog

License

Notifications You must be signed in to change notification settings

reviewdog/action-suggester

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

action-suggester

Test reviewdog depup release GitHub release (latest SemVer) action-bumpr supported Used-by counter

shfmt demo shellcheck demo gofmt demo multiline demo

action-suggester is a handy action which suggests any code changes based on diff through GitHub Multi-line code suggestions by using reviewdog.

You can use any formatters or linters with auto-fix feature for any languages and the reviewdog suggester support any changes including inline change, multi-line changes, insertion, and deletion.

Input

inputs:
  github_token:
    description: 'GITHUB_TOKEN'
    default: '${{ github.token }}'
  ### Flags for reviewdog ###
  tool_name:
    description: 'Tool name to use for reviewdog reporter'
    default: 'reviewdog-suggester'
  level:
    description: 'Report level for reviewdog [info,warning,error]'
    default: 'warning'
  filter_mode:
    description: |
      Filtering mode for the reviewdog command [added,diff_context,file,nofilter].
      Default is diff_context. GitHub suggestions only support added and diff_context.
    default: 'diff_context'
  fail_on_error:
    description: |
      Exit code for reviewdog when errors are found [true,false]
      Default is `false`.
    default: 'false'
  reviewdog_flags:
    description: 'Additional reviewdog flags'
    default: ''
  ### Flags for reviewdog suggester ###
  cleanup:
    description: 'Clean up non-committed changes after the action'
    default: 'true'

Required Permissions

The action requires the following permissions:

permissions:
  contents: read
  checks: write
  issues: write
  pull-requests: write

See Assigning permissions to jobs for more details.

Usage Example

name: reviewdog-suggester
on: [pull_request] # Support only pull_request event.
jobs:
  go:
    name: runner / suggester / gofmt
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: gofmt -w -s .
      - uses: reviewdog/action-suggester@v1
        with:
          tool_name: gofmt
  shell:
    name: runner / suggester / shell
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v4
      - run: go install mvdan.cc/sh/v3/cmd/shfmt@latest

      - run: shfmt -i 2 -ci -w .
      - name: suggester / shfmt
        uses: reviewdog/action-suggester@v1
        with:
          tool_name: shfmt

      # Need to install latest shellcheck to use diff output format as of writing (2020/08/03).
      - name: install shellcheck
        run: |
          scversion="latest"
          wget -qO- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv
          sudo cp "shellcheck-${scversion}/shellcheck" /usr/local/bin/
          rm -rf "shellcheck-${scversion}/shellcheck"
      - run: shellcheck -f diff $(shfmt -f .) | patch -p1
      - name: suggester / shellcheck
        uses: reviewdog/action-suggester@v1
        with:
          tool_name: shellcheck

About

🐶 Suggests any code changes based on diff through GitHub Multi-line code suggestions by using reviewdog

Resources

License

Code of conduct

Stars

Watchers

Forks

Languages