From e29ebaf222386ff538d0ad643dbcfafec185b468 Mon Sep 17 00:00:00 2001 From: Arik Fraimovich Date: Wed, 11 Dec 2019 13:13:33 +0200 Subject: [PATCH] Add auto formatting when committing to master --- .github/workflows/black.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/black.yml diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml new file mode 100644 index 00000000000..9909382d462 --- /dev/null +++ b/.github/workflows/black.yml @@ -0,0 +1,31 @@ +name: Python Code Formatting (Black) + +on: + push: + branches: + - master + +jobs: + format: + runs-on: ubuntu-latest + + container: + image: python:3.7.4-alpine + + steps: + - uses: actions/checkout@v1 + - name: Install Black + run: apk add gcc musl-dev && pip install black + - name: Run Black + run: black redash tests migrations/versions + - name: Commit formatted code + uses: EndBug/add-and-commit@v2.1.0 + with: + author_name: Black + author_email: team@redash.io + message: "Autoformatted Python code with Black" + path: "." + pattern: "*.py" + force: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file