Skip to content

Commit

Permalink
allow if/or for second filename (#8)
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <[email protected]>

Signed-off-by: vsoch <[email protected]>
Co-authored-by: vsoch <[email protected]>
  • Loading branch information
vsoch and vsoch authored Jan 8, 2023
1 parent e1ab947 commit afc4e07
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,28 @@ if [[ ! -f "${INPUT_FILENAME}" ]]; then
exit 1
fi

# Wget the comparison file
PARENT_SHA=$(git log --pretty=%P -n 1 ${CURRENT_SHA} | cut -d ' ' -f 1)
JOBFILE="https://raw.githubusercontent.com/${INPUT_REPO}/${PARENT_SHA}/${INPUT_FILENAME}"
TMP=$(mktemp -d)

BASENAME=$(basename ${INPUT_FILENAME})
wget ${JOBFILE} -O "${TMP}/${BASENAME}"
if [[ "$?" != "0" ]]; then
printf "Issue getting previous job file ${JOBFILE}\n"
exit 1
fi

JOBFILE="${TMP}/${BASENAME}"
if [[ ! -f "${JOBFILE}" ]]; then
printf "${JOBFILE} does not exist.\n"
exit 1
fi

# If we are verbatim given a previous filename, use it
if [ ! -z ${INPUT_PREVIOUS_FILENAME} ]; then
JOBFILE="${INPUT_PREVIOUS_FILENAME}"
else

# Wget the comparison file
PARENT_SHA=$(git log --pretty=%P -n 1 ${CURRENT_SHA} | cut -d ' ' -f 1)
JOBFILE="https://raw.githubusercontent.com/${INPUT_REPO}/${PARENT_SHA}/${INPUT_FILENAME}"
TMP=$(mktemp -d)

BASENAME=$(basename ${INPUT_FILENAME})
wget ${JOBFILE} -O "${TMP}/${BASENAME}"
if [[ "$?" != "0" ]]; then
printf "Issue getting previous job file ${JOBFILE}\n"
exit 1
fi

JOBFILE="${TMP}/${BASENAME}"
if [[ ! -f "${JOBFILE}" ]]; then
printf "${JOBFILE} does not exist.\n"
exit 1
fi
fi

# Required to have slack webhook in environment
Expand Down

0 comments on commit afc4e07

Please sign in to comment.