-
Notifications
You must be signed in to change notification settings - Fork 446
/
Copy pathcheck-component.yml
39 lines (34 loc) · 1.14 KB
/
check-component.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#
# SPDX-License-Identifier: Apache-2.0
#
steps:
- script: |
echo Checking changes in ${{ parameters.componentName }}
dashandapi=("src/api-engine/" "src/dashboard/"
"build_image/docker/common/")
allchanges=$(git diff --name-only HEAD HEAD~1)
echo 'changed files in the pull request'
echo "$allchanges"
hasTopChanges=$(echo "$allchanges" | grep -v '/')
if [ ! -z "$hasTopChanges" ]; then
echo 'Top level changes found, continue!'
echo "##vso[task.setvariable variable=ContinueJob]True"
exit 0
fi
comp=${{ parameters.componentName }}
compItems="${comp}[@]"
changesFound='False'
for item in "${!compItems}"; do
if echo "${allchanges}" | grep -q "$item"
then
changesFound='True'
fi
done
if [ "$changesFound" == 'True' ]; then
echo 'Changes found for the component, continue'
echo "##vso[task.setvariable variable=ContinueJob]True"
else
echo 'No changes found for the component'
echo "##vso[task.setvariable variable=ContinueJob]False"
fi
displayName: "Check changes"