Skip to content

Commit b03c371

Browse files
authored
Code Review Action initial checkin
YAML, Docker and action entry point for GitHub Actions initial checkin
1 parent abe5427 commit b03c371

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

cra-action/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM docker:20.10
2+
3+
RUN apk add bash
4+
5+
COPY entrypoint.sh /entrypoint.sh
6+
RUN chmod +x /entrypoint.sh
7+
8+
9+
ENTRYPOINT ["bash", "/entrypoint.sh"]

cra-action/action.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# action.yml
2+
name: 'Docker Run Action'
3+
description: 'Run a command in a new container'
4+
inputs:
5+
options:
6+
description: 'additional parameters to run the Code Review Agent'
7+
required: true
8+
pr:
9+
description: 'PR URL which needs to be reviewed'
10+
required: true
11+
command:
12+
description: 'Use a specific command'
13+
required: true
14+
default: review
15+
runs:
16+
using: 'docker'
17+
image: 'Dockerfile'

cra-action/entrypoint.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
4+
# Arguments to run the Docker image
5+
echo $INPUT_PR
6+
echo $INPUT_COMMAND
7+
echo $INPUT_OPTIONS
8+
9+
SUPPORTED_COMMANDS=("/review")
10+
11+
INPUT_COMMAND=$(echo "$INPUT_COMMAND" | tr -d '[:space:]')
12+
for command in "${SUPPORTED_COMMANDS[@]}"; do
13+
if [ "$command" = "$INPUT_COMMAND" ]; then
14+
valid_command=true
15+
break
16+
fi
17+
done
18+
19+
20+
# Run the Docker container from the specified image
21+
if [ "$valid_command" = true ]; then
22+
exec docker run bitoai/cra:latest --mode=cli --pr_url $INPUT_PR $INPUT_COMMAND $INPUT_OPTIONS
23+
else
24+
echo "$INPUT_COMMAND is not supported"
25+
exit 0 # Exit the script with a non-zero status code
26+
fi

0 commit comments

Comments
 (0)