File size: 840 Bytes
a3290d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
name: Autoformat code

on:
    push:
      branches: [ 'main' ]
    pull_request:
      branches: [ 'main' ]

jobs:
  format:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Format code
        run: |
          pip install black
          black .
      - name: Sort imports
        run: |
          pip install isort
          isort .
      - name: Remove unused imports
        run: |
          pip install autoflake
          autoflake --in-place --remove-all-unused-imports --remove-unused-variables --recursive .
      - name: Commit changes
        uses: EndBug/add-and-commit@v4
        with:
          author_name: ${{ github.actor }}
          author_email: ${{ github.actor }}@users.noreply.github.com
          message: "Autoformat code"
          add: "."
          branch: ${{ github.ref }}