GithubHelp home page GithubHelp logo

furusax0621 / action-golangci-lint Goto Github PK

View Code? Open in Web Editor NEW

This project forked from reviewdog/action-golangci-lint

0.0 1.0 0.0 58 KB

Run golangci-lint with reviewdog

Home Page: https://github.com/marketplace?type=actions&query=reviewdog

License: MIT License

Dockerfile 39.20% Shell 60.80%

action-golangci-lint's Introduction

GitHub Action: Run golangci-lint with reviewdog

Docker Image CI Docker Cloud Build Status Docker Pulls depup release GitHub release (latest SemVer) action-bumpr supported

This action runs golangci-lint with reviewdog on pull requests to improve code review experience.

annotation on diff tab example check tab example status check example

Inputs

github_token

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

golangci_lint_flags

Optional. golangci-lint flags. (golangci-lint run --out-format=line-number <golangci_lint_flags>)

Note that you can change golangci-lint behavior by configuration file too.

tool_name

Optional. Tool name to use for reviewdog reporter. Useful when running multiple actions with different config.

level

Optional. Report level for reviewdog [info,warning,error]. It's same as -level flag of reviewdog.

reporter

Optional. Reporter of reviewdog command [github-pr-check,github-pr-review]. It's same as -reporter flag of reviewdog.

filter_mode

Optional. Filtering mode for the reviewdog command [added,diff_context,file,nofilter]. Default is added.

fail_on_error

Optional. Exit code for reviewdog when errors are found [true,false] Default is false.

reviewdog_flags

Optional. Additional reviewdog flags

Example usage

Minimum Usage Example

name: reviewdog
on: [pull_request]
jobs:
  golangci-lint:
    name: runner / golangci-lint
    runs-on: ubuntu-latest
    steps:
      - name: Check out code into the Go module directory
        uses: actions/checkout@v1
      - name: golangci-lint
        uses: reviewdog/action-golangci-lint@v1
        # uses: docker://reviewdog/action-golangci-lint:v1 # pre-build docker image
        with:
          github_token: ${{ secrets.github_token }}

Advanced Usage Example

name: reviewdog
on: [pull_request]
jobs:
  # NOTE: golangci-lint doesn't report multiple errors on the same line from
  # different linters and just report one of the errors?

  golangci-lint:
    name: runner / golangci-lint
    runs-on: ubuntu-latest
    steps:
      - name: Check out code into the Go module directory
        uses: actions/checkout@v1
      - name: golangci-lint
        uses: docker://reviewdog/action-golangci-lint:v1 # Pre-built image
        # uses: reviewdog/action-golangci-lint@v1 # Build with Dockerfile
        # uses: docker://reviewdog/action-golangci-lint:v1.0.2 # Can use specific version.
        # uses: reviewdog/[email protected] # Can use specific version.
        with:
          github_token: ${{ secrets.github_token }}
          # Can pass --config flag to change golangci-lint behavior and target
          # directory.
          golangci_lint_flags: "--config=.github/.golangci.yml ./testdata"

  # Use golint via golangci-lint binary with "warning" level.
  golint:
    name: runner / golint
    runs-on: ubuntu-latest
    steps:
      - name: Check out code into the Go module directory
        uses: actions/checkout@v1
      - name: golint
        uses: reviewdog/action-golangci-lint@v1
        with:
          github_token: ${{ secrets.github_token }}
          golangci_lint_flags: "--disable-all -E golint"
          tool_name: golint # Change reporter name.
          level: warning # GitHub Status Check won't become failure with this level.

  # You can add more and more supported linters with different config.
  errcheck:
    name: runner / errcheck
    runs-on: ubuntu-latest
    steps:
      - name: Check out code into the Go module directory
        uses: actions/checkout@v1
      - name: errcheck
        uses: reviewdog/action-golangci-lint@v1
        with:
          github_token: ${{ secrets.github_token }}
          golangci_lint_flags: "--disable-all -E errcheck"
          tool_name: errcheck
          level: info

All-in-one golangci-lint configuration without config file

name: reviewdog
on: [pull_request]
jobs:
  golangci-lint:
    name: runner / golangci-lint
    runs-on: ubuntu-latest
    steps:
      - name: Check out code into the Go module directory
        uses: actions/checkout@v1
      - name: golangci-lint
        uses: reviewdog/action-golangci-lint@v1
        with:
          github_token: ${{ secrets.github_token }}
          golangci_lint_flags: "--enable-all --exclude-use-default=false"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.