Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/test_cra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ jobs:
if [[ -n "${{ vars.STATIC_ANALYSIS_TOOL }}" ]]; then
STATIC_ANALYSIS_TOOL_OPTION=" --static_analysis_tool=${{ vars.STATIC_ANALYSIS_TOOL }}"
fi
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
REVIEW_SCOPE_OPTION=""
if [[ -n "${{ vars.REVIEW_SCOPE }}" ]]; then
REVIEW_SCOPE_OPTION=" --review_scope=${{ vars.REVIEW_SCOPE }}"
fi
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
- name: Code Review Agent - Issue Comment
if: github.event_name == 'issue_comment'
uses: gitbito/codereviewagent@main
Expand All @@ -45,7 +49,11 @@ jobs:
if [[ -n "${{ vars.STATIC_ANALYSIS_TOOL }}" ]]; then
STATIC_ANALYSIS_TOOL_OPTION=" --static_analysis_tool=${{ vars.STATIC_ANALYSIS_TOOL }}"
fi
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
REVIEW_SCOPE_OPTION=""
if [[ -n "${{ vars.REVIEW_SCOPE }}" ]]; then
REVIEW_SCOPE_OPTION=" --review_scope=${{ vars.REVIEW_SCOPE }}"
fi
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
- name: Code Review Agent action step
if: github.event_name == 'pull_request'
uses: gitbito/codereviewagent@main
Expand Down
10 changes: 7 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ echo $INPUT_OPTIONS

SUPPORTED_COMMANDS=("/review" "review")

INPUT_COMMAND=$(echo "$INPUT_COMMAND" | tr -d '[:space:]')
#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 [ "$command" = "$INPUT_COMMAND" ]; then
if [[ "$INPUT_COMMAND" =~ ^$command ]]; then
valid_command=true
break
fi
Expand All @@ -20,7 +24,7 @@ done
# Run the Docker container from the specified image
if [ "$valid_command" = true ]; then
docker pull bitoai/cra:latest >&2
exec docker run bitoai/cra:latest --mode=cli --pr_url $INPUT_PR $INPUT_COMMAND $INPUT_OPTIONS
exec docker run bitoai/cra:latest --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
Expand Down