fix, checkout DEFAULT_BRANCH for diff base (#1308)

This commit is contained in:
Kim SeungSu 2021-03-05 23:57:16 +09:00 committed by GitHub
parent 11720172cb
commit 68c8bf9f11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,6 +68,34 @@ function BuildFileList() {
# Need to build a list of all files changed # Need to build a list of all files changed
# This can be pulled from the GITHUB_EVENT_PATH payload # This can be pulled from the GITHUB_EVENT_PATH payload
################
# print header #
################
debug "----------------------------------------------"
debug "Pulling in code history and branches..."
#################################################################################
# Switch codebase back to the default branch to get a list of all files changed #
#################################################################################
SWITCH_CMD=$(
git -C "${GITHUB_WORKSPACE}" pull --quiet
git -C "${GITHUB_WORKSPACE}" checkout "${DEFAULT_BRANCH}" 2>&1
)
#######################
# Load the error code #
#######################
ERROR_CODE=$?
##############################
# Check the shell for errors #
##############################
if [ ${ERROR_CODE} -ne 0 ]; then
# Error
info "Failed to switch to ${DEFAULT_BRANCH} branch to get files changed!"
fatal "[${SWITCH_CMD}]"
fi
if [ "${GITHUB_EVENT_NAME}" == "push" ]; then if [ "${GITHUB_EVENT_NAME}" == "push" ]; then
################ ################
# push event # # push event #