mirror of
https://github.com/super-linter/super-linter.git
synced 2024-12-25 08:42:13 -05:00
Move switch back to code branch (#1139)
Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
This commit is contained in:
parent
5c31b85619
commit
88645c0977
1 changed files with 22 additions and 22 deletions
|
@ -161,6 +161,27 @@ function BuildFileList() {
|
|||
warn "No files were found in the GITHUB_WORKSPACE:[${GITHUB_WORKSPACE}] to lint!"
|
||||
fi
|
||||
|
||||
if [ "${VALIDATE_ALL_CODEBASE}" == "false" ]; then
|
||||
#########################################
|
||||
# Need to switch back to branch of code #
|
||||
#########################################
|
||||
SWITCH2_CMD=$(git -C "${GITHUB_WORKSPACE}" checkout --progress --force "${GITHUB_SHA}" 2>&1)
|
||||
|
||||
#######################
|
||||
# Load the error code #
|
||||
#######################
|
||||
ERROR_CODE=$?
|
||||
|
||||
##############################
|
||||
# Check the shell for errors #
|
||||
##############################
|
||||
if [ ${ERROR_CODE} -ne 0 ]; then
|
||||
# Error
|
||||
error "Failed to switch back to branch!"
|
||||
fatal "[${SWITCH2_CMD}]"
|
||||
fi
|
||||
fi
|
||||
|
||||
################################################
|
||||
# Iterate through the array of all files found #
|
||||
################################################
|
||||
|
@ -183,7 +204,7 @@ function BuildFileList() {
|
|||
##########################################################
|
||||
if [ ! -f "${FILE}" ]; then
|
||||
# File not found in workspace
|
||||
debug "File:{$FILE} existed in commit data, but not found on file system, skipping..."
|
||||
warn "File:{$FILE} existed in commit data, but not found on file system, skipping..."
|
||||
continue
|
||||
fi
|
||||
|
||||
|
@ -669,27 +690,6 @@ function BuildFileList() {
|
|||
debug ""
|
||||
done
|
||||
|
||||
if [ "${VALIDATE_ALL_CODEBASE}" == "false" ]; then
|
||||
#########################################
|
||||
# Need to switch back to branch of code #
|
||||
#########################################
|
||||
SWITCH2_CMD=$(git -C "${GITHUB_WORKSPACE}" checkout --progress --force "${GITHUB_SHA}" 2>&1)
|
||||
|
||||
#######################
|
||||
# Load the error code #
|
||||
#######################
|
||||
ERROR_CODE=$?
|
||||
|
||||
##############################
|
||||
# Check the shell for errors #
|
||||
##############################
|
||||
if [ ${ERROR_CODE} -ne 0 ]; then
|
||||
# Error
|
||||
error "Failed to switch back to branch!"
|
||||
fatal "[${SWITCH2_CMD}]"
|
||||
fi
|
||||
fi
|
||||
|
||||
################
|
||||
# Footer print #
|
||||
################
|
||||
|
|
Loading…
Reference in a new issue