This composite action runs flake8 with reviewdog on pull requests to lint to lint python source files while creating annotations. It does this by installing the Python flake8 package in an environment with a Python interpreter and executes flake8 stylistic and logical linting of Python source files. Following reviewdog is used to parse the bash output into GitHub annotations. This (composite) action is meant to be run inside an existing workflow and therefore, does not install python or set up a python environment.
In it's simplest form this action can be used to annotate the changes that are suggested by the flake8 linter.
name: flake8 Lint
on: [push, pull_request]
jobs:
flake8-lint:
runs-on: ubuntu-latest
name: Lint
steps:
- name: Check out source repository
uses: actions/checkout@v2
- name: Set up Python environment
uses: actions/setup-python@v2
with:
python-version: "3.8"
# Install specific flake8 version (this step is not required. Default is "latest").
- run: pip install flake8==6.0.0
# Install flake8 extensions (this step is not required. Default is "None").
- run: pip install flake8-docstrings flake8-simplify flake8-unused-arguments flake8-quotes
- name: flake8 Lint
uses: reviewdog/action-flake8@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
See the Inputs section below for details on the defaults and optional configuration settings.
Required. The GITHUB_TOKEN. Must be in form of github_token: ${{ secrets.github_token }}
. Defaults to ${{ github.token }}
.
Optional. The directory to run flake8 in. Defaults to .
.
Optional. Command-line arguments to the flake8 executable. Defaults to ""
.
Please note that some command-line arguments can be defined with other fields in your configuration. You may combine the args
setting with the other settings below, or use args
to configure flake8 without the other Action settings.
Optional. The log level of the reviewdog reporter. Options: [info, warning, error]
. Defaults to error
.
Optional. Reporter of reviewdog command [github-pr-check, github-pr-review, github-check]
. Defaults to github-pr-check
.
Optional. Filtering mode for the reviewdog command [added, diff_context, file, nofilter]
. Defaults to added
.
Optional. Exit code for reviewdog when errors are found [true, false]
. Defaults to false
.
Optional. Additional reviewdog flags. Defaults to ""
.
Optional. Tool name to use for reviewdog reporter. Defaults to flake8
..
Optional. Pre-defined error format [flake8, pep8]
. Defaults to flake8
.