diff --git a/.github/workflows/test_cra.yml b/.github/workflows/test_cra.yml index 2b5b18a..f727ffa 100644 --- a/.github/workflows/test_cra.yml +++ b/.github/workflows/test_cra.yml @@ -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 @@ -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 diff --git a/entrypoint.sh b/entrypoint.sh index d164ace..1c1f121 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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 @@ -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