-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathentrypoint.sh
executable file
·74 lines (59 loc) · 1.22 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
#!/bin/bash
#
# The core of our action, it will be invoked with the name of the script
# to execute - If the script doesn't exist then that is a fatal error.
#
# The script used to default to `.github/run-tests.sh`, but now the
# name is passed as the first argument.
#
#
# Terminate upon errors
#
set -e
#
# Get the name of the script to run.
#
script=$1
#
# If the argument is empty that is a fatal error.
#
if [ -z "${script}" ]; then
echo "You must specify the script to execute as an argument."
exit 1
fi
#
# If the script does not exist that is a fatal-error.
#
if [ ! -e "${script}" ]; then
echo "The supplied testing-script does not exist: ${script}"
exit 1
fi
#
# Ensure the script is executable.
#
chmod 755 "${script}"
#
# Run it.
#
${script}
#
# If the script exits with a non-zero status-code
# then it will terminate this script due to the use
# of `set -e`.
#
# So when we reach this point we know:
#
# 1. We've executed the test-script.
#
# 2. The test-script passed.
#
# Exit cleanly because we're done.
#
exit 0
#
# There is no test-script within the repository.
#
# Show that, and exit with a failure-code.
#
echo "The repository does not contain a test-script '.github/run-tests.sh'"
exit 1