Repository navigation
49 lines (40 loc) · 1.7 KB
/
Copy pathprecommit.yml
File metadata and controls
49 lines (40 loc) · 1.7 KB
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
---
# .github/workflows/precommit.yml
name: Pre-commit checks
on:
push:
branches: [main]
pull_request:
branches: ['**']
jobs:
pre-commit:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v7.0.1
with:
fetch-depth: 0
- name: Reject temporary artifacts in release PRs
if: github.event_name == 'pull_request' && startsWith(github.head_ref, 'rel-')
run: |
set -euo pipefail
artifacts="$(git ls-tree -r --name-only HEAD -- .pr)"
if [ -n "$artifacts" ]; then
echo "::error::Release contains temporary .pr artifacts. Refresh the release branch so the update that merges main also removes .pr/; see 'Refreshing a release branch' in .github/workflows/README-RELEASE.md."
printf '%s\n' "$artifacts"
exit 1
fi
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: '3.13'
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
- name: Install dependencies
run: uv sync --frozen --group dev
- name: Ensure dynamic attribute baseline only shrinks
run: >-
uv run python scripts/check_forbidden_dynamic_attributes.py
--baseline-ref ${{ github.event.pull_request.base.sha || github.event.before }}
- name: Run pre-commit (all files)
run: uv run pre-commit run --all-files --show-diff-on-failure