Skip to content

Warning

You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?

PyLint with dynamic badge

Actions
Perform pylint check on one or multiple packages/python files and update badge in README.md
v1
Star (10)

PyLint with badge - GitHub Action

GitHub action that lets you easily lint one or multiple packages of your project and adds a dynamic badge to your README.md that lets you display the obtained score!

Each time the action is run, packages specified will be linted and a badge in the README.md is updated dynamically following one of the below rules:

Range PyLint score Badge
PyLint score $< 5$ pylint-red
$5 \le$ PyLint score $< 8$ pylint-orange
$8 \le$ PyLint score $< 10$ pylint-yellow
PyLint score $= 10$ pylint-green

The action can be triggered by a Pull request, a Push or manually with workflow_dispatch. If the score is changed, the github_action bot will change your badge with an automatic commit

A quick example on how you would typically use this action (more examples in scenario section)

- uses: Silleellie/pylint-github-action@v1
  with:
    package-path: src  # lint src package
    python-version: 3.9  # python version which will lint the package

Preliminary steps

To use this action you should perform two simple first-time-only operations:

  1. In order to have a dynamic updated badge, before using for the first time this action, you should put a placeholder badge in your README.md which will be substituted by the actual one as soon as you run this action.
    The placeholder badge should be in one of the following formats:

![pylint]() or [![pylint]()](https://redirect/link)

  1. Be sure to set write permissions to GitHub actions in your repo settings! You can change it in Settings > Actions > General, then go to subsection Workflow Permissions and thick the Read and write permission option

Usage

- uses: Silleellie/pylint-github-action@v1
  with:
    
    # Path of the package(s) to lint, relative to the repository root. 
    # If more than one package should be linted, simply specify all of them 
    # with the multi-line notation like so:
    # package-path: |
    #   src
    #   other_src
    #   ...
    # 
    # Required
    package-path: src
    
    # Version of the Python interpreter which will install all requirements of your project 
    # and lint the package(s) specified with the `package-path` argument
    #
    # Required
    python-version: 3.9

    # Path of the requirements of your project, relative to the repository root. 
    # This can be easily changed in case you have `requirements-dev.txt`
    #
    # Optional, Default: requirements.txt
    requirements-path: requirements.txt
    
    # Path of the README.md to update with the pylint badge, relative to the repository root.
    #
    # Optional, Default: README.md
    readme-path: README.md

Scenario

Single package to lint

- uses: Silleellie/pylint-github-action@v1
  with:
    package-path: src
    python-version: 3.11

Multiple packages to lint

- uses: Silleellie/pylint-github-action@v1
  with:
    package-path: |
      src
      app
      other_src/inner_src
    python-version: 3.11

Different path for requirements file

- uses: Silleellie/pylint-github-action@v1
  with:
    package-path: src
    python-version: 3.11
    requirements-path: requirements/requirements-dev.txt

Different path for README.md file

- uses: Silleellie/pylint-github-action@v1
  with:
    package-path: src
    python-version: 3.11
    readme-path: models/README.md

Credits

This is a composite github action which uses the following godly working actions:

PyLint with dynamic badge is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Perform pylint check on one or multiple packages/python files and update badge in README.md
v1

PyLint with dynamic badge is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.