From ab3f02fe268d0249a2abc82bad967829678f3716 Mon Sep 17 00:00:00 2001 From: IvanKuchin Date: Fri, 23 Oct 2020 12:16:14 -0400 Subject: [PATCH 1/2] bugfix: #900 --- lib/buildFileList.sh | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/lib/buildFileList.sh b/lib/buildFileList.sh index 3bdce5db..e45bb301 100755 --- a/lib/buildFileList.sh +++ b/lib/buildFileList.sh @@ -53,16 +53,35 @@ function BuildFileList() { fatal "[${SWITCH_CMD}]" fi - ################ - # print header # - ################ - debug "----------------------------------------------" - debug "Generating Diff with:[git diff --name-only '${DEFAULT_BRANCH}...${GITHUB_SHA}' --diff-filter=d]" + if [ "${GITHUB_EVENT_NAME}" == "push" ]; then + ################ + # push event # + ################ + ################ + # print header # + ################ + debug "----------------------------------------------" + debug "Generating Diff with:[git diff-tree --no-commit-id --name-only -r ${GITHUB_SHA}]" - ################################################# - # Get the Array of files changed in the commits # - ################################################# - mapfile -t RAW_FILE_ARRAY < <(git -C "${GITHUB_WORKSPACE}" diff --name-only "${DEFAULT_BRANCH}...${GITHUB_SHA}" --diff-filter=d 2>&1) + ################################################# + # Get the Array of files changed in the commits # + ################################################# + mapfile -t RAW_FILE_ARRAY < <(git diff-tree --no-commit-id --name-only -r ${GITHUB_SHA} 2>&1) + else + ################ + # PR event # + ################ + ################ + # print header # + ################ + debug "----------------------------------------------" + debug "Generating Diff with:[git diff --name-only '${DEFAULT_BRANCH}...${GITHUB_SHA}' --diff-filter=d]" + + ################################################# + # Get the Array of files changed in the commits # + ################################################# + mapfile -t RAW_FILE_ARRAY < <(git -C "${GITHUB_WORKSPACE}" diff --name-only "${DEFAULT_BRANCH}...${GITHUB_SHA}" --diff-filter=d 2>&1) + fi else WORKSPACE_PATH="${GITHUB_WORKSPACE}" if [ "${TEST_CASE_RUN}" == "true" ]; then From 98a0a194ad6ffc1f79b061d062bf32c477393166 Mon Sep 17 00:00:00 2001 From: IvanKuchin Date: Sat, 24 Oct 2020 14:46:30 -0400 Subject: [PATCH 2/2] Update buildFileList.sh fix syntax issue to pass bash linter --- lib/buildFileList.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/buildFileList.sh b/lib/buildFileList.sh index e45bb301..cd3229a4 100755 --- a/lib/buildFileList.sh +++ b/lib/buildFileList.sh @@ -61,12 +61,12 @@ function BuildFileList() { # print header # ################ debug "----------------------------------------------" - debug "Generating Diff with:[git diff-tree --no-commit-id --name-only -r ${GITHUB_SHA}]" + debug "Generating Diff with:[git diff-tree --no-commit-id --name-only -r \"${GITHUB_SHA}]\"" ################################################# # Get the Array of files changed in the commits # ################################################# - mapfile -t RAW_FILE_ARRAY < <(git diff-tree --no-commit-id --name-only -r ${GITHUB_SHA} 2>&1) + mapfile -t RAW_FILE_ARRAY < <(git diff-tree --no-commit-id --name-only -r "${GITHUB_SHA}" 2>&1) else ################ # PR event #