File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 1616 fi
1717fi
1818
19+ if [[ " $COMMIT_MESSAGE " =~ Merge\ pull\ request\ \# ([0-9]* ) ]]; then
20+
21+ # This is a merge from a pull request
22+ PR_NUMBER=" ${BASH_REMATCH[1]} "
23+ COMMIT_MESSAGE=" $( printf " %s" " $COMMIT_MESSAGE " | tail -n 1) "
24+ fi
25+
1926IMAGES_FILE=" library/node"
2027REPO_NAME=" official-images"
2128ORIGIN_SLUG=" $GITHUB_USERNAME /$REPO_NAME "
@@ -130,12 +137,18 @@ if updated; then
130137 if [ " $url " != " null" ]; then
131138 info " Pull request created at $url "
132139
140+ if [ ! -z " $PR_NUMBER " ]; then
141+ comment_endpoint=" https://api.github.com/repos/$DOCKER_SLUG /issues/$PR_NUMBER /comments"
142+ else
143+ comment_endpoint=" https://api.github.com/repos/$DOCKER_SLUG /commits/$COMMIT_ID /comments"
144+ fi
145+
133146 info " Creating Commit Comment"
134147 commit_response_payload=" $( curl -H " $( auth_header) " \
135148 -s \
136149 -X POST \
137150 -d " $( comment_payload " $url " ) " \
138- " https://api.github.com/repos/ $DOCKER_SLUG /commits/ $COMMIT_ID /comments " ) "
151+ " $comment_endpoint " ) "
139152
140153 if [ " $( echo " $commit_response_payload " | jq .message) " != " null" ]; then
141154 fatal " Error linking the pull request ($error_message )"
You can’t perform that action at this time.
0 commit comments