-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheorPublish.sh
32 lines (23 loc) · 984 Bytes
/
eorPublish.sh
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
#!/usr/bin/bash
#COMMIT=$(git log --name-only --pretty=format:"%H" --full-index -n 1 )
COMMIT=$(git log --name-only --pretty=format:"%H") && git diff-tree --no-commit-id --name-only -r $COMMIT | sort | uniq
echo "Commit object :" $COMMIT
curl -X POST \
-H "Content-Type: application/json" \
-d $COMMIT \
https://endpointtest20230412121510.azurewebsites.net/api/Github/Receive
FILES=($COMMIT)
echo "Files :" ${FILES[@]}
len=${#FILES[@]}
for (( i=0; i<${len}; i++)); do
DIR=$(dirname "${FILES[$i]}")
#echo "Processing the file ${FILES[$i]} from the directory ${DIR}"
if [[ ${DIR} == 'api/'* ]]; then
EXTENSION=$(echo ${FILES[$i]#*.})
if [ ${EXTENSION} == "yaml" ]; then
FILE=$(basename ${FILES[$i]} | cut -f 1 -d '.')
echo "commited file:=> ${DIR}/${FILE}.yaml"
# ${SCRIPT_PATH}/generateFile.sh ${DIR}/${FILE}.yaml ${OpenAPI_TEMPLATE} "generated/${DIR}/${FILE}.html"
fi
fi
done