Skip to content

Add test

Add test #578

Workflow file for this run

# Uses Black to reformat the Python code on the all but the main branch.
name: Format
on:
push:
branches:
- '**' # matches every branch
- '!main' # excludes master
permissions:
contents: write
jobs:
format:
runs-on: ubuntu-latest
steps:
# Checkout the main branch
- uses: actions/checkout@v3
# Setup Python environment
- uses: actions/setup-python@v3
# Install black
- name: Install black
run: pip install black
# Execute black in check mode
- name: Black
id: black
run: echo ::set-output name=format::$(black --check --quiet . || echo "true")
# Execute black and commit the change to the main branch
- name: Commit to the main branch
if: steps.black.outputs.format == 'true'
run: |
black .
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git commit -am "[github-action] formatting fixes"
git push