Skip to content

Latest commit

 

History

History
35 lines (21 loc) · 1.54 KB

poetry-black.md

File metadata and controls

35 lines (21 loc) · 1.54 KB

Documentation for poetry-black.yml workflow

poetry-black.yml is a reusable GitHub workflow for the Black code formatter for Python.

How to use

Create a new workflow file in all repositories whose files should get formatted with Black.

The following example config runs Black on all pull requests:

name: Run Black code formatter

on: pull_request

jobs:
  poetry-black:
    uses: acdh-oeaw/prosnet-workflows/.github/workflows/poetry-black.yml@RELEASE_VERSION
    with:
      src: "."

Required settings

  • RELEASE_VERSION needs to be set to a valid prosnet-workflows release tag, branch name or SHA.
  • src refers to the path from which Black will work its way down the hierarchical file structure. The example uses ".", the current working directory, which may serve you best. Only change it if you need Black to start from a different directory instead.

Optional settings

The following optional variables can be added to the with section of the config:

  • python-version: The Python version for which to set up Poetry, which is used to run Black. For APIS projects, the prosnet-workflows default should work best.
  • options: Arguments with which to run poetry run black, see Black command line options. If you set this variable, it will override the prosnet-workflows defaults.