File tree Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Copyright (C) 2024 Intel Corporation
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ name : File Change Warning
5
+
6
+ on :
7
+ pull_request :
8
+ branches : [main]
9
+ types : [opened, reopened, ready_for_review, synchronize]
10
+
11
+ # If there is a new commit, the previous jobs will be canceled
12
+ concurrency :
13
+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14
+ cancel-in-progress : true
15
+
16
+ jobs :
17
+ file-change-detection :
18
+ runs-on : ubuntu-latest
19
+ steps :
20
+ - name : Clean Up Working Directory
21
+ run : sudo rm -rf ${{github.workspace}}/*
22
+
23
+ - name : Checkout code
24
+ uses : actions/checkout@v4
25
+ with :
26
+ fetch-depth : 0
27
+
28
+ - name : Clone repo GenAIExamples
29
+ run : |
30
+ cd ..
31
+ git clone https://github.com/opea-project/GenAIExamples
32
+
33
+ - name : Check for changed Dockerfile paths
34
+ run : |
35
+ shopt -s globstar
36
+ cd ${{github.workspace}}
37
+ is_use="FALSE"
38
+ used_files=""
39
+ merged_commit=$(git log -1 --format='%H')
40
+ changed_files="$(git diff --name-status --diff-filter=DR ${{ github.event.pull_request.base.sha }} ${merged_commit} -- '**/Dockerfile' | cut -f2)"
41
+ if [ -n "$changed_files" ]; then
42
+ for file in $changed_files; do
43
+ if grep -q "$file" ../GenAIExamples/**/*.md; then
44
+ is_use="TRUE"
45
+ used_files+="$file "
46
+ fi
47
+ done
48
+ fi
49
+
50
+ if [[ "$is_use" == "TRUE" ]]; then
51
+ echo "Warning: Changed Dockerfile paths:"
52
+ echo "$used_files"
53
+ echo "Please modify the corresponding README in GenAIExamples repo and ask [email protected] for final confirmation."
54
+ exit 1
55
+ fi
You can’t perform that action at this time.
0 commit comments