-
Notifications
You must be signed in to change notification settings - Fork 1
35 lines (35 loc) · 1020 Bytes
/
format-code.yml
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
34
35
name: Format code and sort imports
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- uses: actions/[email protected]
with:
python-version: '^3.11'
- uses: actions/cache@v4
with:
path: |
~/.cache/pypoetry
~/.virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install Poetry
run: curl -sSL https://install.python-poetry.org | python3 -
- name: Install dependencies
run: poetry install --only dev
- name: Run formatting commands
run: make format
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Format code and sort imports
branch: ${{ github.head_ref }}