ci: set up GH action that enforces black formatting on changed lines #13
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python Formatting | |
on: [push, pull_request] | |
jobs: | |
darker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
cache: 'pip' | |
- name: Install darker | |
run: pip install darker | |
- name: Run darker | |
run: | | |
darker --revision origin/main . --diff --check || (echo "Formatting of changed lines does not respect 'black'. Please run 'darker --revision origin/main .' and commit the changes."; false) |