File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : pre-commit
22
33on :
4+ workflow_dispatch :
45 pull_request :
6+ branches :
7+ - pybind11
58 push :
9+ branches :
10+ - pybind11
611
712jobs :
813 pre-commit :
914 runs-on : ubuntu-22.04
1015 steps :
11- - uses : actions/checkout@v3
12- - uses : actions/setup-python@v4
16+ - uses : actions/checkout@v4
1317 with :
14- python-version : ' 3.10'
15- - uses : pre-commit/action@v3.0.0
18+ fetch-depth : 0
19+
20+ - uses : actions/setup-python@v5
1621 with :
17- extra_args : " --all-files"
22+ python-version : ' 3.10'
23+
24+ - name : Install pre-commit
25+ run : python -m pip install pre-commit
26+
27+ - name : Run pre-commit on changed files
28+ shell : bash
29+ run : |
30+ if [[ "${{ github.event_name }}" == "pull_request" ]]; then
31+ base_ref="${{ github.event.pull_request.base.sha }}"
32+ elif [[ -n "${{ github.event.before }}" && ! "${{ github.event.before }}" =~ ^0+$ ]]; then
33+ base_ref="${{ github.event.before }}"
34+ else
35+ base_ref="$(git rev-parse HEAD~1)"
36+ fi
37+
38+ pre-commit run --show-diff-on-failure --color=always --from-ref "$base_ref" --to-ref "${{ github.sha }}"
You can’t perform that action at this time.
0 commit comments