-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
entrypoint.sh
executable file
·111 lines (84 loc) · 2.52 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
set -e
printf "Found files in workspace:\n"
ls
printf "Looking for urlchecker install...\n"
which urlchecker
COMMAND="urlchecker check "
# branch is optional
if [ ! -z "${INPUT_BRANCH}" ]; then
COMMAND="${COMMAND} --branch ${INPUT_BRANCH}"
fi
# cleanup is optional (boolean)
if [ "${INPUT_CLEANUP}" == "true" ]; then
COMMAND="${COMMAND} --cleanup"
fi
# subfolder is optional
if [ ! -z "${INPUT_SUBFOLDER}" ]; then
COMMAND="${COMMAND} --subfolder ${INPUT_SUBFOLDER}"
fi
# print all defaults to true (unless set to false)
if [ "${INPUT_PRINT_ALL}" == "false" ]; then
COMMAND="${COMMAND} --no-print"
echo "Automated PR requested"
fi
# verbose defaults to false
if [ "${INPUT_VERBOSE}" == "true" ]; then
COMMAND="${COMMAND} --verbose"
fi
# run in serial for debugging?
if [ "${INPUT_SERIAL}" == "true" ]; then
COMMAND="${COMMAND} --serial"
fi
# Do we have a number of workers defined?
if [ ! -z "${INPUT_WORKERS}" ]; then
export URLCHECKER_WORKERS=${INPUT_WORKERS}
fi
# file types are optional
if [ ! -z "${INPUT_FILE_TYPES}" ]; then
COMMAND="${COMMAND} --file-types ${INPUT_FILE_TYPES}"
fi
# exclude (previously whitelisted) urls are optional
if [ ! -z "${INPUT_EXCLUDE_URLS}" ]; then
COMMAND="${COMMAND} --exclude-urls ${INPUT_EXCLUDE_URLS}"
fi
# exclude (previously white listed) patterns are optional
if [ ! -z "${INPUT_EXCLUDE_PATTERNS}" ]; then
COMMAND="${COMMAND} --exclude-patterns ${INPUT_EXCLUDE_PATTERNS}"
fi
# exclude (previously white listed) files are optional
if [ ! -z "${INPUT_EXCLUDE_FILES}" ]; then
COMMAND="${COMMAND} --exclude-files ${INPUT_EXCLUDE_FILES}"
fi
# retry count (optional)
if [ ! -z "${INPUT_RETRY_COUNT}" ]; then
COMMAND="${COMMAND} --retry-count ${INPUT_RETRY_COUNT}"
fi
# timeout (optional)
if [ ! -z "${INPUT_TIMEOUT}" ]; then
COMMAND="${COMMAND} --timeout ${INPUT_TIMEOUT}"
fi
# files (optional)
if [ ! -z "${INPUT_INCLUDE_FILES}" ]; then
COMMAND="${COMMAND} --files ${INPUT_INCLUDE_FILES}"
fi
# save (optional)
if [ ! -z "${INPUT_SAVE}" ]; then
COMMAND="${COMMAND} --save ${INPUT_SAVE}"
fi
# force pass (optional)
if [ "${INPUT_FORCE_PASS}" == "true" ]; then
echo "Force pass requested."
COMMAND="${COMMAND} --force-pass"
fi
# git path, if not defined, we assume $PWD
if [ -z "${INPUT_GIT_PATH}" ]; then
echo "git_path not set, will use present working directory."
COMMAND="${COMMAND} ."
else
echo "git_path set, will use for path or clone."
COMMAND="${COMMAND} ${INPUT_GIT_PATH}"
fi
echo "${COMMAND}"
${COMMAND}
echo $?