Debian Codegraph @

.github/workflows/lint.yml

raw
1 name: lint and format
2
3 on: [push, pull_request]
4
5 permissions: {}
6
7 jobs:
8 lint:
9 # We want to run on external PRs, but not on our own internal PRs as they'll be run
10 # by the push to the branch. Without this if check, checks are duplicated since
11 # internal PRs match both the push and pull_request events.
12 if:
13 github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
14 github.repository
15
16 runs-on: ubuntu-latest
17
18 steps:
19 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
20 with:
21 persist-credentials: false
22
23 - name: Assert PR target is main
24 if: github.event_name == 'pull_request' && github.repository == 'psf/black'
25 run: |
26 if [ "$GITHUB_BASE_REF" != "main" ]; then
27 echo "::error::PR targeting '$GITHUB_BASE_REF', please refile targeting 'main'." && exit 1
28 fi
29
30 - name: Set up latest Python
31 uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
32 with:
33 python-version: "3.13"
34 pip-version: "25.3"
35 pip-install: -e . --group tox
36
37 - name: Run pre-commit hooks
38 uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
39
40 - name: Format ourselves
41 run: tox -e run_self
42
43 - name: Regenerate schema
44 run: |
45 tox -e generate_schema
46 git diff --exit-code