You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by si...@apache.org on 2020/02/22 04:06:23 UTC

[pulsar-test-infra] branch master updated: Use GITHUB_SHA for finding pr base commit (#6)

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

sijie 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 ae3e944  Use GITHUB_SHA for finding pr base commit (#6)
ae3e944 is described below

commit ae3e9446e00f4214b9119228bacadfebbf40a09d
Author: Yijie Shen <he...@gmail.com>
AuthorDate: Sat Feb 22 12:06:18 2020 +0800

    Use GITHUB_SHA for finding pr base commit (#6)
    
    Per documentation:
    
    GITHUB_SHA is Last merge commit on the GITHUB_REF branch
    and GITHUB_REF is PR merge branch refs/pull/:prNumber/merge
    
    Therefore, we could use GITHUB_SHA~commitNumber for pr base commit.
---
 diff-only/entrypoint.sh | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/diff-only/entrypoint.sh b/diff-only/entrypoint.sh
index 2084b30..2a5a6b2 100755
--- a/diff-only/entrypoint.sh
+++ b/diff-only/entrypoint.sh
@@ -7,9 +7,8 @@ COMMITS=$(jq '.pull_request.commits' "${GITHUB_EVENT_PATH}")
 echo "COMMITS: ${COMMITS}"
 
 git --version
-git rev-parse --abbrev-ref HEAD
 
-CHANGED_DIRS=$(git diff --dirstat=files,0 HEAD~${COMMITS} | awk '{ print $2 }')
+CHANGED_DIRS=$(git diff --dirstat=files,0 ${GITHUB_SHA}~${COMMITS} | awk '{ print $2 }')
 echo "CHANGED_DIRS are : ${CHANGED_DIRS}"
 
 found_changed_dir_not_in_target_dirs="no"
@@ -35,4 +34,4 @@ if [[ ${found_changed_dir_not_in_target_dirs} == "yes" ]]; then
 else
     echo "Changes ${CHANGED_DIRS} only in $*, setting 'changed_only' to 'yes'"
     echo ::set-output name=changed_only::yes
-fi
\ No newline at end of file
+fi