File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # SPDX-FileCopyrightText: (c) UIUC PurpCode Team
2+ #
3+ # SPDX-License-Identifier: Apache-2.0
4+
5+ name : CI
6+
7+ on :
8+ pull_request :
9+ branches : [ main ]
10+ push :
11+ branches : [ main ]
12+
13+ jobs :
14+ pre-commit :
15+ name : Pre-commit checks
16+ runs-on : ubuntu-latest
17+ steps :
18+ - name : Checkout code
19+ uses : actions/checkout@v4
20+ with :
21+ fetch-depth : 0 # Needed for pre-commit to work properly
22+
23+ - name : Set up Python
24+ uses : actions/setup-python@v5
25+ with :
26+ python-version : ' 3.11'
27+
28+ - name : Cache pre-commit environments
29+ uses : actions/cache@v4
30+ with :
31+ path : ~/.cache/pre-commit
32+ key : pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
33+ restore-keys : |
34+ pre-commit-${{ runner.os }}-
35+
36+ - name : Install pre-commit
37+ run : pip install pre-commit
38+
39+ - name : Run pre-commit on all files
40+ run : pre-commit run --all-files --show-diff-on-failure --color=always
41+
42+ - name : Run pre-commit on changed files only (for PRs)
43+ if : github.event_name == 'pull_request'
44+ run : |
45+ # Get the list of changed files
46+ git fetch origin ${{ github.base_ref }}
47+ pre-commit run --from-ref origin/${{ github.base_ref }} --to-ref HEAD --show-diff-on-failure --color=always
Original file line number Diff line number Diff line change 1+ # SPDX-FileCopyrightText: (c) UIUC PurpCode Team
2+ #
3+ # SPDX-License-Identifier: Apache-2.0
4+
5+ name : Pre-commit
6+
7+ on :
8+ pull_request :
9+ branches : [ main ]
10+ push :
11+ branches : [ main ]
12+
13+ jobs :
14+ pre-commit :
15+ runs-on : ubuntu-latest
16+ steps :
17+ - uses : actions/checkout@v4
18+
19+ - name : Set up Python
20+ uses : actions/setup-python@v5
21+ with :
22+ python-version : ' 3.x'
23+
24+ - name : Install pre-commit
25+ run : pip install pre-commit
26+
27+ - name : Cache pre-commit
28+ uses : actions/cache@v4
29+ with :
30+ path : ~/.cache/pre-commit
31+ key : pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
32+
33+ - name : Run pre-commit
34+ run : pre-commit run --all-files
You can’t perform that action at this time.
0 commit comments