From 0a68136729959ed53285de68f74fde9602a82afc Mon Sep 17 00:00:00 2001 From: Peter Hill Date: Wed, 26 Jul 2023 13:55:31 +0100 Subject: [PATCH] CI: Auto-apply black formatting --- .github/workflows/black.yml | 37 +++++++++++++++++++++++++++++ .github/workflows/master.yml | 18 -------------- .github/workflows/pythonpackage.yml | 18 -------------- 3 files changed, 37 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/black.yml diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml new file mode 100644 index 00000000..fd267d5f --- /dev/null +++ b/.github/workflows/black.yml @@ -0,0 +1,37 @@ +name: black + +on: + pull_request: + paths: + - '**.py' + +defaults: + run: + shell: bash + +jobs: + black: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.head_ref }} + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.x + - name: Install black + run: | + python -m pip install --upgrade pip + pip install black + - name: Version + run: | + python --version + black --version + - name: Run black + run: | + black xbout + black docs + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "Apply black formatting" diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 6f752708..80a01b53 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -89,21 +89,3 @@ jobs: # run: | # pip install flake8 # flake8 - - - black: - - runs-on: ubuntu-latest - if: always() - - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v1 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - - name: Check formatting with black - run: | - pip install black - black --check . diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 38625b7e..7708b822 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -88,21 +88,3 @@ jobs: # run: | # pip install flake8 # flake8 - - - black: - - runs-on: ubuntu-latest - if: always() - - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v1 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - - name: Check formatting with black - run: | - pip install black - black --check .