Skip to content
book-open

GitHub Action

Python Interrogate Check

v0.1.2 Latest version

Python Interrogate Check

book-open

Python Interrogate Check

Customisable GitHub action to use interrogate to check Python docstring coverage in your repository

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Python Interrogate Check

uses: JackMcKew/python-interrogate-check@v0.1.2

Learn more about this action in JackMcKew/python-interrogate-check

Choose a version

python-interrogate-check

A customisable GitHub action to check the style of Python code with interrogate.

Inputs

You can use inputs to alter how interrogate will check your code docstrings.

Path

This tells interrogate where to look for files to check.

fail-under (optional)

Fail when coverage % is less than a given amount.

Default: 80

badge-location (optional)

Generate a shields.io status badge (an SVG image) in at a given file or directory.

Default: .

ignore-module (optional)

Ignore module-level docstrings when running interrogate.

Default: False

Example usage

Include this in your .github/workflows/main.yaml:

uses: JackMcKew/python-interrogate-check@main
with:
  path: 'package_name'

Full Example

Here is an entire workflow for updating a badge as well. Note you will need to set up an access token for the repository.

name: Interrogate documentation

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2

    - name: Set up Python 3.8
      uses: actions/setup-python@v2
      with:
        python-version: 3.8

    - name: Python Interrogate Check
      uses: JackMcKew/python-interrogate-check@main
      with:
        path: 'sample_package'
        badge-location: 'badges/interrogate_badge.svg'

    - name: Commit files
      run: |
        git config --local user.email "action@github.com"
        git config --local user.name "GitHub Action"
        git add badges/interrogate_badge.svg
        git diff --exit-code || git commit -m "Update interrogate_badge.svg" -a

    - name: Push changes
      if: success()
      uses: ad-m/github-push-action@master
      with:
        github_token: ${{ secrets.ACCESS_TOKEN }}