You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2020/11/20 05:33:29 UTC

[pulsar-test-infra] branch master updated: Make the cherry-pick bot carry the cherry-pick message info (#15)

This is an automated email from the ASF dual-hosted git repository.

penghui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-test-infra.git


The following commit(s) were added to refs/heads/master by this push:
     new 6871646  Make the cherry-pick bot carry the cherry-pick message info (#15)
6871646 is described below

commit 6871646a50f0045fa1885023124e0a429c9e63c8
Author: Yong Zhang <zh...@gmail.com>
AuthorDate: Fri Nov 20 13:33:21 2020 +0800

    Make the cherry-pick bot carry the cherry-pick message info (#15)
---
 cherry-pick/entrypoint.sh | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/cherry-pick/entrypoint.sh b/cherry-pick/entrypoint.sh
index 72efc42..111fae4 100755
--- a/cherry-pick/entrypoint.sh
+++ b/cherry-pick/entrypoint.sh
@@ -1,7 +1,5 @@
 #!/bin/bash
 
-set -x
-
 cat ${GITHUB_EVENT_PATH}
 
 GITHUB_TOKEN=${GITHUB_TOKEN:-""}
@@ -59,7 +57,7 @@ cherrypick() {
     git checkout ${TARGET_BRANCH}
     git checkout -b ${BOT_BRANCH_NAME}
     git status
-    git cherry-pick "${PR_MERGE_COMMIT_SHA}" -X Recursive
+    git cherry-pick -x "${PR_MERGE_COMMIT_SHA}" -X Recursive
     status=$?
     if [[ ${status} != 0 ]]; then
         git add .
@@ -71,10 +69,16 @@ cherrypick() {
 
 pr_close_prompt_args() {
     readonly PR_NUMBER=$(jq -r '.number' "${GITHUB_EVENT_PATH}")
-    readonly PR_INFO=$(curl -s --request GET \
-        --url https://api.github.com/repos/${GITHUB_REPOS}/pulls/${PR_NUMBER} \
-        --header "Authorization: token ${GITHUB_TOKEN}" \
-        --header 'Accept: application/vnd.github.sailor-v-preview+json')
+    if [[ "" == "${GITHUB_TOKEN}" ]]; then
+        readonly PR_INFO=$(curl -s --request GET \
+            --url https://api.github.com/repos/${GITHUB_REPOS}/pulls/${PR_NUMBER} \
+            --header 'Accept: application/vnd.github.sailor-v-preview+json')
+    else
+       readonly PR_INFO=$(curl -s --request GET \
+            --url https://api.github.com/repos/${GITHUB_REPOS}/pulls/${PR_NUMBER} \
+            --header "Authorization: token ${GITHUB_TOKEN}" \
+            --header 'Accept: application/vnd.github.sailor-v-preview+json')
+    fi
 }
 
 pr_close_prompt() {