Automatic Elixir code reviews with Credo, GitHub Workflows, and Reviewdog

Some time ago GitHub announced Actions (still in beta, but with public access) that is like built-in CI service with great integration into rest of GitHub. This allows developers to define their own actions to be reused by others and publish them on Marketplace.

So I created new action that allows to run automatic Credo reviews by utilising great Reviewdog tool.

Usage is pretty simple. If you have Workflows enabled you just create new file named .github/workflows/lint.yml that contains:

name: Lints CI

on: [pull_request]

jobs:
  credo:
    runs-on: ubuntu-latest
    container:
      image: elixir:1.9.1-slim
    steps:
    - uses: actions/checkout@v1
    - name: Install Dependencies
      run: |
        mix local.rebar --force
        mix local.hex --force
        mix deps.get
    - name: Run Credo
      uses: hauleth/reviewdog-action-credo@v1
      with:
        github_token: ${{ secrets.github_token }}

And as the result you will get report with style violations.

10 Likes