Skip to content

Commit afc4e07

Browse files
authored
allow if/or for second filename (#8)
Signed-off-by: vsoch <vsoch@users.noreply.github.com> Signed-off-by: vsoch <vsoch@users.noreply.github.com> Co-authored-by: vsoch <vsoch@users.noreply.github.com>
1 parent e1ab947 commit afc4e07

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

entrypoint.sh

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,28 @@ if [[ ! -f "${INPUT_FILENAME}" ]]; then
1111
exit 1
1212
fi
1313

14-
# Wget the comparison file
15-
PARENT_SHA=$(git log --pretty=%P -n 1 ${CURRENT_SHA} | cut -d ' ' -f 1)
16-
JOBFILE="https://raw.githubusercontent.com/${INPUT_REPO}/${PARENT_SHA}/${INPUT_FILENAME}"
17-
TMP=$(mktemp -d)
18-
19-
BASENAME=$(basename ${INPUT_FILENAME})
20-
wget ${JOBFILE} -O "${TMP}/${BASENAME}"
21-
if [[ "$?" != "0" ]]; then
22-
printf "Issue getting previous job file ${JOBFILE}\n"
23-
exit 1
24-
fi
25-
26-
JOBFILE="${TMP}/${BASENAME}"
27-
if [[ ! -f "${JOBFILE}" ]]; then
28-
printf "${JOBFILE} does not exist.\n"
29-
exit 1
30-
fi
31-
3214
# If we are verbatim given a previous filename, use it
3315
if [ ! -z ${INPUT_PREVIOUS_FILENAME} ]; then
3416
JOBFILE="${INPUT_PREVIOUS_FILENAME}"
17+
else
18+
19+
# Wget the comparison file
20+
PARENT_SHA=$(git log --pretty=%P -n 1 ${CURRENT_SHA} | cut -d ' ' -f 1)
21+
JOBFILE="https://raw.githubusercontent.com/${INPUT_REPO}/${PARENT_SHA}/${INPUT_FILENAME}"
22+
TMP=$(mktemp -d)
23+
24+
BASENAME=$(basename ${INPUT_FILENAME})
25+
wget ${JOBFILE} -O "${TMP}/${BASENAME}"
26+
if [[ "$?" != "0" ]]; then
27+
printf "Issue getting previous job file ${JOBFILE}\n"
28+
exit 1
29+
fi
30+
31+
JOBFILE="${TMP}/${BASENAME}"
32+
if [[ ! -f "${JOBFILE}" ]]; then
33+
printf "${JOBFILE} does not exist.\n"
34+
exit 1
35+
fi
3536
fi
3637

3738
# Required to have slack webhook in environment

0 commit comments

Comments
 (0)