-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpointAp.sh
More file actions
44 lines (34 loc) · 1.25 KB
/
pointAp.sh
File metadata and controls
44 lines (34 loc) · 1.25 KB
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
40
41
42
43
44
#!/bin/bash
COUNT=1
PAP_AVAILABLE=0
FUNCTION=""
echo "start"
set_comment() {
API_HEADER="Accept: application/vnd.github.v3+json; application/vnd.github.antiope-preview+json"
AUTH_HEADER="Authorization: token ${GITHUB_TOKEN}"
curl -sSL \
-H "Content-Type: application/json" \
-H "${AUTH_HEADER}" \
-H "${API_HEADER}" \
-X POST \
-d "{\"body\":\"$1\"}" \
"https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${number}/comments"
}
cd /github/workspace
git diff origin/develop | grep -E '^(commit|@@|[+]\s.+\WAp)' > diff.txt
while IFS= read -r LINE; do
if echo $LINE | egrep '^[+]\s.+\WAp'; then
if [ $PAP_AVAILABLE == 1 ] ;then
echo "Ap used, pAp is also available in ${FUNCTION} ${LINE}"
# else
# echo "Ap used, because pAp is not available in ${FUNCTION} ${LINE}"
fi
elif echo $LINE | egrep '[(].+pAp.?[)]'; then
PAP_AVAILABLE=1
FUNCTION=$LINE
elif echo $LINE | egrep '[(].?[)]'; then
PAP_AVAILABLE=0
FUNCTION=$LINE
fi
done < diff.txt
set_comment "checked"