Skip to content

A GitHub Action that lints Python code with Flake8 then automatically creates pull request reviews if there are any violations.

License

Notifications You must be signed in to change notification settings

epsyhealth/actions-lintly-flake8

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lintly-Flake8 GitHub Action

A GitHub Action that lints Python code with Flake8 then automatically creates pull request reviews if there are any violations. Uses Lintly under the hood.

See this pull request for an example.

Usage

To use Lintly-Flake8 GitHub Action, add the following to a GitHub Actions workflow file such as .github/workflows/main.yml:

on: [pull_request]

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: grantmcconnaughey/lintly-flake8-github-action@v1.0
        with:
          # The GitHub API token to create reviews with
          token: ${{ secrets.GITHUB_TOKEN }}
          # Fail if "new" violations detected or "any", default "new"
          failIf: new
          # Additional arguments to pass to flake8, default "." (current directory)
          args: "--ignore=E121,E123 ."

Now each PR created will be linted with Flake8. If there are any violations then Lintly will comment on the PR using the github-actions bot user.

Lintly example

Note: Lintly-Flake8 only works with the pull_request event. If your job runs on the push event then make sure the Lintly-Flake8 step only runs on the pull request event by adding if: github.event_name == 'pull_request':

      - uses: grantmcconnaughey/lintly-flake8-github-action@v1.0
        if: github.event_name == 'pull_request'

About

A GitHub Action that lints Python code with Flake8 then automatically creates pull request reviews if there are any violations.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Dockerfile 79.0%
  • Shell 21.0%