File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,13 +12,21 @@ echo "SHA: $GITHUB_SHA"
1212echo " REF: $GITHUB_REF "
1313echo " HEAD-REF: $GITHUB_HEAD_REF "
1414echo " BASE-REF: $GITHUB_BASE_REF "
15- echo " TOKEN: $GITHUB_TOKEN "
1615pwd
1716
1817RESULT=0
1918
19+ # Get PR number
20+ PR=${GITHUB_REF# " refs/pull/" }
21+ PRNUM=${PR% " /merge" }
22+
23+ # Get commit list using Github API
24+ URL=https://api.github.com/repos/${GITHUB_REPOSITORY} /pulls/${PRNUM} /commits
25+ list=$( curl $URL -X GET -s -H " Authorization: token ${GITHUB_TOKEN} " | jq ' .[].sha' -r)
26+ echo $list
27+
2028# Run review.sh on each commit in the PR
21- for sha1 in $( git rev- list origin/ $GITHUB_BASE_REF ..origin/ $GITHUB_HEAD_REF ) ; do
29+ for sha1 in $list ; do
2230 echo " Check - Commit id $sha1 "
2331 /review.sh ${sha1} || RESULT=1;
2432 echo " Result: ${RESULT} "
Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ MESSAGE=
2525# Write message to specific file and line
2626function post_code_message()
2727{
28- curl $CODE_URL -s -H " Authorization: token ${GITHUB_TOKEN} " \
28+ echo " POST to ${CODE_URL} with ${MESSAGE} "
29+ curl ${CODE_URL} -H " Authorization: token ${GITHUB_TOKEN} " \
2930 -X POST --data " $( cat << EOF
3031{
3132 "commit_id": "$COMMIT ",
4041# Write message to pull-request comment
4142function post_comment_message()
4243{
43- curl $BODY_URL -s -H " Authorization: token ${GITHUB_TOKEN} " \
44+ echo " POST to ${BODY_URL} with ${MESSAGE} "
45+ curl ${BODY_URL} -H " Authorization: token ${GITHUB_TOKEN} " \
4446 -H " Content-Type: application/json" \
4547 -X POST --data " $( cat << EOF
4648{
You can’t perform that action at this time.
0 commit comments