bump: version 0.5.0 → 0.5.1 #10
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: ci-normalize-code | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
normalize-code: | |
if: "!startsWith(github.event.head_commit.message, 'bump:')" | |
name: "Normalize code with internal standards" | |
permissions: write-all | |
strategy: | |
fail-fast: true | |
matrix: | |
python-version: ['3.10'] | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out | |
uses: actions/checkout@v2 | |
with: | |
token: "${{ secrets.GITHUB_TOKEN }}" | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Run image | |
uses: abatilo/[email protected] | |
with: | |
poetry-version: 1.4.0 | |
- name: Cache Poetry virtualenv | |
uses: actions/cache@v1 | |
id: cache | |
with: | |
path: ~/.virtualenvs | |
key: venv-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
restore-keys: | | |
venv-${{ matrix.os }}-${{ matrix.python-version }}- | |
- name: Set Poetry config | |
run: | | |
poetry config virtualenvs.in-project false | |
poetry config virtualenvs.path ~/.virtualenvs | |
- name: Install Dependencies | |
run: poetry install --only dev | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Autoformat code if the check fails | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
run: | | |
poetry run isort . | |
poetry run black . | |
git config --global user.name '${{ github.actor }}' | |
git config --global user.email '${{ github.actor }}@users.noreply.github.com' | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY | |
git checkout $GITHUB_HEAD_REF | |
git commit -am "chore: autoformat isort & black" && git push || true |