Skip to content

Fixed replacing of repeated values. #1333

Fixed replacing of repeated values.

Fixed replacing of repeated values. #1333

# SPDX-FileCopyrightText: 2017-2023 Contributors to the OpenSTEF project <[email protected]> # noqa E501
#
# SPDX-License-Identifier: MPL-2.0
# Copied from https://github.com/psf/black/actions/runs/17913292/workflow
# GitHub Action that uses Black to reformat the Python code in an incoming pull request.
# If all Python code in the pull request is compliant with Black then this Action
# does nothing. Otherwise, Black is run and its changes are committed to the
# incoming pull request. See https://github.com/cclauss/autoblack for a similar example.
name: Black Format Code
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']
steps:
# Checkout
- name: Checkout
uses: actions/checkout@v2
# Setup
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
# Install black
- name: Install Black
run: pip install black==23.9.1 pydocstyle==6.1.1 docformatter==1.5.0 toml==0.10.2
# Run black --check
- name: Run black --check . and PydocStyle check
run: |
black --check .
pydocstyle .
# Run black (if needed)
- name: If needed, commit black changes to the pull request
if: failure()
run: |
black .
docformatter openstef --recursive --wrap-summaries 120 --in-place
git config --global user.name 'black'
git config --global user.email '[email protected]'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git fetch
git checkout ${{ github.head_ref }}
git commit --signoff -am "Format Python code with Black"
git push