File tree 1 file changed +32
-0
lines changed
1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Check Changed Files in PR
2
+
3
+ on :
4
+ pull_request :
5
+ types : [opened, synchronize]
6
+
7
+ jobs :
8
+ check_files :
9
+ runs-on : ubuntu-latest
10
+
11
+ steps :
12
+ - name : Checkout code
13
+ uses : actions/checkout@v2
14
+
15
+ - name : Count changed files
16
+ id : count_files
17
+ run : |
18
+ git fetch --prune --unshallow
19
+ num_changed_files=$(git diff --name-only origin/${{ github.base_ref }} ${{ github.sha }} | wc -l)
20
+ echo "::set-output name=num_changed_files::$num_changed_files"
21
+
22
+
23
+
24
+ - name : Check if only 1 file changed
25
+ run : |
26
+ changed_files=${{ steps.count_files.outputs.num_changed_files }}
27
+ if [ $changed_files -ne 1 ]; then
28
+ echo "More than 1 file changed. Exiting."
29
+ exit 1
30
+ else
31
+ echo "Exactly 1 file changed. Proceeding."
32
+ fi
You can’t perform that action at this time.
0 commit comments