Skip to content

Github Action that runs rubocop for PRs

Notifications You must be signed in to change notification settings

Zopolis4/Octocop

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

octocop

 

Runs rubocop and reports results with reviewdog.

It's specifically designed for pull requests, and will report results only on the diff against the PR base.

If you're using something like CodeClimate, and don't like that existing external tools don't run against PRs that don't target your repo default branch, this is for you.

reporter input is important. Thanks to reviewdog, this can either just fail checks at a given level, or additionally comment on the PR directly for each relevant failure.

Requires on: [pull_request] - the existing marketplace actions are more globally valid. This will still check every push to a PR.

 

Inputs

github_token

Required. Must be in form of github_token: ${{ secrets.github_token }}'.

rubocop_flags

Optional. String to pass to rubocop, defaults to passing nothing.

tool_name

Optional. Tool name to use for the resulting reviewdog report. Useful when running multiple actions with different reviewdog reports.

level

Optional. Report level for reviewdog [info, warning, error]. Defaults to 'error'.

reporter

Optional. Reporter of reviewdog command [github-pr-check, github-pr-review]. Defaults to github-pr-review.

rubocop_version

Optional. Defaults to passing nothing to gem install rubocop. Let me know if you have a config string not supported outside of -v.

additional_gems

Optional. String to pass to gem install after rubocop and relevant possible dependencies install, if present.

 

Example usage

name: Rubocop

on: [pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: rubocop
      uses: Freshly/[email protected]
      with:
        github_token: ${{ secrets.github_token }}
        rubocop_version: 0.74
        reporter: github-pr-check
        additional_gems: "spicerack-styleguide"
        rubocop_flags: "-c rubocop/rubocop.yml --except Style/StringLiterals"

Thanks and Alternatives

Originally forked from https://github.com/mgrachev/action-rubocop ❤️

Includes code from https://github.com/andrewmcodes/rubocop-linter-action ❤️

Logo thanks to the unrelated pursuits of https://github.com/dan1229/OctoCop ❤️

About

Github Action that runs rubocop for PRs

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 84.0%
  • Dockerfile 16.0%