diff --git a/.github/workflows/formatter.yaml b/.github/workflows/formatter.yaml new file mode 100644 index 000000000..9eb84ccff --- /dev/null +++ b/.github/workflows/formatter.yaml @@ -0,0 +1,25 @@ +name: Formatter + +on: + push: + branches: + - main + - dev + pull_request: + branches: + - main + - dev + - feature/** + +jobs: + formatter: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Add a problem matcher + run: echo "::add-matcher::.github/workflows/matchers/black.json" + - name: Format + uses: psf/black@stable + with: + options: "--check --diff --color --line-length 120" diff --git a/.github/workflows/matchers/black.json b/.github/workflows/matchers/black.json new file mode 100644 index 000000000..2c161a0fe --- /dev/null +++ b/.github/workflows/matchers/black.json @@ -0,0 +1,15 @@ +{ + "problemMatcher": [ + { + "owner": "black", + "severity": "error", + "pattern": [ + { + "regexp": "^(would reformat) (.+)$", + "file": 2, + "message": 1 + } + ] + } + ] +}