Skip to content

Commit 005cc8a

Browse files
committed
fix commit list
Signed-off-by: Inho Oh <inho.oh@sk.com>
1 parent cbc9d8b commit 005cc8a

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

entrypoint.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,21 @@ echo "SHA: $GITHUB_SHA"
1212
echo "REF: $GITHUB_REF"
1313
echo "HEAD-REF: $GITHUB_HEAD_REF"
1414
echo "BASE-REF: $GITHUB_BASE_REF"
15-
echo "TOKEN: $GITHUB_TOKEN"
1615
pwd
1716

1817
RESULT=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}"

review.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ MESSAGE=
2525
# Write message to specific file and line
2626
function 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",
@@ -40,7 +41,8 @@ EOF
4041
# Write message to pull-request comment
4142
function 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
{

0 commit comments

Comments
 (0)