-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathentrypoint.sh
More file actions
31 lines (23 loc) · 800 Bytes
/
entrypoint.sh
File metadata and controls
31 lines (23 loc) · 800 Bytes
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
#!/bin/bash
# Arguments to run the Docker image
echo $INPUT_PR
echo $INPUT_COMMAND
echo $INPUT_OPTIONS
SUPPORTED_COMMANDS=("/review" "review")
#INPUT_COMMAND=$(echo "$INPUT_COMMAND" | tr -d '[:space:]')
INPUT_COMMAND=$(echo "$INPUT_COMMAND" | xargs)
# Check if the command starts with any of the supported commands
for command in "${SUPPORTED_COMMANDS[@]}"; do
if [[ "$INPUT_COMMAND" =~ ^$command ]]; then
valid_command=true
break
fi
done
# Run the Docker container from the specified image
if [ "$valid_command" = true ]; then
docker pull bitoai/cra:1.2.8 >&2
exec docker run bitoai/cra:1.2.8 --mode=cli --pr_url $INPUT_PR --command "$INPUT_COMMAND" rest $INPUT_OPTIONS
else
echo "$INPUT_COMMAND is not supported"
exit 0 # Exit the script with a non-zero status code
fi