summaryrefslogtreecommitdiff
path: root/.github/workflows/lint.yml
blob: fc900318d2b9421df47a319c082bac18867d775c (plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Lint

on:
  push:
    paths:
      - "**.py"
      - "**.pyi"
      - ".github/workflows/lint.yml"
  pull_request:
    branches:
      - main

jobs:
  lint:
    runs-on: ubuntu-latest
    name: Lint Code

    steps:
      - name: Checkout 🛎️
        uses: actions/checkout@v3

      - name: Setup Python 🐍
        uses: actions/[email protected]
        with:
          python-version: 3.8.5

      - uses: Gr1N/setup-poetry@v7

      - uses: actions/[email protected]
        with:
          path: ~/.cache/pypoetry
          key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}

      - name: Install Dependencies 🔧
        env:
          POETRY_VIRTUALENVS_CREATE: "true"
        run: |
          poetry install
          python -m pip install --upgrade pip
          pip install black
          
      - name: Run Linters
        uses: wearerequired/[email protected]
        with:
          auto_fix: true
          black: true
          black_auto_fix: true
          commit_message: ":rotating_light: 自动进行代码格式化"
          git_email: [email protected]