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 16
16
fi
17
17
fi
18
18
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
+
19
26
IMAGES_FILE=" library/node"
20
27
REPO_NAME=" official-images"
21
28
ORIGIN_SLUG=" $GITHUB_USERNAME /$REPO_NAME "
@@ -130,12 +137,18 @@ if updated; then
130
137
if [ " $url " != " null" ]; then
131
138
info " Pull request created at $url "
132
139
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
+
133
146
info " Creating Commit Comment"
134
147
commit_response_payload=" $( curl -H " $( auth_header) " \
135
148
-s \
136
149
-X POST \
137
150
-d " $( comment_payload " $url " ) " \
138
- " https://api.github.com/repos/ $DOCKER_SLUG /commits/ $COMMIT_ID /comments " ) "
151
+ " $comment_endpoint " ) "
139
152
140
153
if [ " $( echo " $commit_response_payload " | jq .message) " != " null" ]; then
141
154
fatal " Error linking the pull request ($error_message )"
You can’t perform that action at this time.
0 commit comments