Commit b57268b 1 parent 2c971c7 commit b57268b Copy full SHA for b57268b
File tree 1 file changed +38
-0
lines changed
1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Pre-commit checks
2
+
3
+ on :
4
+ pull_request :
5
+ branches :
6
+ - main
7
+
8
+ jobs :
9
+ pre-commit :
10
+ runs-on : ubuntu-latest
11
+
12
+ steps :
13
+ - name : Checkout code
14
+ uses : actions/checkout@v2
15
+
16
+ - name : Set up Python
17
+ uses : actions/setup-python@v2
18
+ with :
19
+ python-version : ' 3.9'
20
+
21
+ - name : Install dependencies
22
+ run : |
23
+ python -m pip install --upgrade pip
24
+ pip install pre-commit
25
+ pre-commit install-hooks
26
+
27
+ - name : Get list of modified files
28
+ id : files
29
+ run : |
30
+ echo "MODIFIED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }})" >> $GITHUB_ENV
31
+
32
+ - name : Run pre-commit on modified files
33
+ run : |
34
+ if [ -n "${{ env.MODIFIED_FILES }}" ]; then
35
+ pre-commit run --files ${{ env.MODIFIED_FILES }}
36
+ else
37
+ echo "No files to check"
38
+ fi
You can’t perform that action at this time.
0 commit comments