GitHub Actions integration¶
You can use Black within a GitHub Actions workflow without setting your own Python environment. Great for enforcing that your code matches the Black code style.
Usage¶
Create a file named .github/workflows/black.yml
inside your repository with:
name: Lint
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: psf/black@stable
We recommend the use of the @stable
tag, but per version tags also exist if you prefer
that.
You may use options
(Default is '--check --diff'
) and src
(Default is '.'
) as
follows:
- uses: psf/black@stable
with:
options: "--check --verbose"
src: "./src"