Skip to content

Commit 428402f

Browse files
Merge pull request #19 from gitbito/BITO-4616
Update entrypoint.sh
2 parents 895941f + e0fa0d4 commit 428402f

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

.github/workflows/test_cra.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ jobs:
2525
if [[ -n "${{ vars.STATIC_ANALYSIS_TOOL }}" ]]; then
2626
STATIC_ANALYSIS_TOOL_OPTION=" --static_analysis_tool=${{ vars.STATIC_ANALYSIS_TOOL }}"
2727
fi
28-
echo "OPTIONS=--static_analysis.fb_infer.enabled=True --code_feedback=True --dependency_check.enabled=False --bee.path=/automation-platform --bee.actn_dir=/automation-platform/default_bito_ad/bito_modules --git.access_token=${{ secrets.GIT_ACCESS_TOKEN }} --bito_cli.bito.access_key=${{ secrets.BITO_ACCESS_KEY }}${GIT_DOMAIN_OPTION}${STATIC_ANALYSIS_TOOL_OPTION}" >> $GITHUB_ENV
28+
REVIEW_SCOPE_OPTION=""
29+
if [[ -n "${{ vars.REVIEW_SCOPE }}" ]]; then
30+
REVIEW_SCOPE_OPTION=" --review_scope=${{ vars.REVIEW_SCOPE }}"
31+
fi
32+
echo "OPTIONS=--static_analysis.fb_infer.enabled=True --code_feedback=True --dependency_check.enabled=False --bee.path=/automation-platform --bee.actn_dir=/automation-platform/default_bito_ad/bito_modules --git.access_token=${{ secrets.GIT_ACCESS_TOKEN }} --bito_cli.bito.access_key=${{ secrets.BITO_ACCESS_KEY }}${GIT_DOMAIN_OPTION}${STATIC_ANALYSIS_TOOL_OPTION}${REVIEW_SCOPE_OPTION}" >> $GITHUB_ENV
2933
- name: Code Review Agent - Issue Comment
3034
if: github.event_name == 'issue_comment'
3135
uses: gitbito/codereviewagent@main
@@ -45,7 +49,11 @@ jobs:
4549
if [[ -n "${{ vars.STATIC_ANALYSIS_TOOL }}" ]]; then
4650
STATIC_ANALYSIS_TOOL_OPTION=" --static_analysis_tool=${{ vars.STATIC_ANALYSIS_TOOL }}"
4751
fi
48-
echo "OPTIONS=--static_analysis.fb_infer.enabled=True --code_feedback=True --dependency_check.enabled=False --bee.path=/automation-platform --bee.actn_dir=/automation-platform/default_bito_ad/bito_modules --git.access_token=${{ secrets.GIT_ACCESS_TOKEN }} --bito_cli.bito.access_key=${{ secrets.BITO_ACCESS_KEY }}${GIT_DOMAIN_OPTION}${STATIC_ANALYSIS_TOOL_OPTION}" >> $GITHUB_ENV
52+
REVIEW_SCOPE_OPTION=""
53+
if [[ -n "${{ vars.REVIEW_SCOPE }}" ]]; then
54+
REVIEW_SCOPE_OPTION=" --review_scope=${{ vars.REVIEW_SCOPE }}"
55+
fi
56+
echo "OPTIONS=--static_analysis.fb_infer.enabled=True --code_feedback=True --dependency_check.enabled=False --bee.path=/automation-platform --bee.actn_dir=/automation-platform/default_bito_ad/bito_modules --git.access_token=${{ secrets.GIT_ACCESS_TOKEN }} --bito_cli.bito.access_key=${{ secrets.BITO_ACCESS_KEY }}${GIT_DOMAIN_OPTION}${STATIC_ANALYSIS_TOOL_OPTION}${REVIEW_SCOPE_OPTION}" >> $GITHUB_ENV
4957
- name: Code Review Agent action step
5058
if: github.event_name == 'pull_request'
5159
uses: gitbito/codereviewagent@main

entrypoint.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ echo $INPUT_OPTIONS
88

99
SUPPORTED_COMMANDS=("/review" "review")
1010

11-
INPUT_COMMAND=$(echo "$INPUT_COMMAND" | tr -d '[:space:]')
11+
#INPUT_COMMAND=$(echo "$INPUT_COMMAND" | tr -d '[:space:]')
12+
INPUT_COMMAND=$(echo "$INPUT_COMMAND" | xargs)
13+
14+
15+
# Check if the command starts with any of the supported commands
1216
for command in "${SUPPORTED_COMMANDS[@]}"; do
13-
if [ "$command" = "$INPUT_COMMAND" ]; then
17+
if [[ "$INPUT_COMMAND" =~ ^$command ]]; then
1418
valid_command=true
1519
break
1620
fi
@@ -20,7 +24,7 @@ done
2024
# Run the Docker container from the specified image
2125
if [ "$valid_command" = true ]; then
2226
docker pull bitoai/cra:latest >&2
23-
exec docker run bitoai/cra:latest --mode=cli --pr_url $INPUT_PR $INPUT_COMMAND $INPUT_OPTIONS
27+
exec docker run bitoai/cra:latest --mode=cli --pr_url $INPUT_PR --command "$INPUT_COMMAND" rest $INPUT_OPTIONS
2428
else
2529
echo "$INPUT_COMMAND is not supported"
2630
exit 0 # Exit the script with a non-zero status code

0 commit comments

Comments
 (0)