139 lines
5.4 KiB
YAML
139 lines
5.4 KiB
YAML
name: 'AI Code Assistant for Gitea - Reusable Action'
|
|
description: 'AI Assistant for reviewing pull-requests and responding to issues in Gitea repositories'
|
|
inputs:
|
|
gitea_token:
|
|
description: 'Gitea token for authentication'
|
|
required: true
|
|
anthropic_api_key:
|
|
description: 'Anthropic API key'
|
|
required: true
|
|
model:
|
|
description: 'Claude model to use'
|
|
required: false
|
|
default: ''
|
|
cc_bgmodel:
|
|
description: 'Background Claude model to use'
|
|
required: false
|
|
default: ''
|
|
cc_metric_url:
|
|
description: 'Base URL for the metrics API endpoint'
|
|
required: false
|
|
default: ''
|
|
cc_base_url:
|
|
description: 'Base URL for the Claude API endpoint'
|
|
required: false
|
|
default: ''
|
|
enable_reviewer_verification:
|
|
description: 'Whether to verify that the bot is assigned as a reviewer before running'
|
|
required: false
|
|
default: ''
|
|
team_name:
|
|
description: 'Team name for telemetry/metrics attribution'
|
|
required: false
|
|
default: ''
|
|
log_level:
|
|
description: 'Log level for the AI review process'
|
|
required: false
|
|
default: ''
|
|
options_type:
|
|
description: 'Options type for the AI review process'
|
|
required: false
|
|
default: ''
|
|
cc_prompt:
|
|
description: 'Custom prompt override for the AI review'
|
|
required: false
|
|
default: ''
|
|
cc_allowed_tool:
|
|
description: 'Comma-separated list of allowed tools for the AI review'
|
|
required: false
|
|
default: ''
|
|
cc_disallowed_tool:
|
|
description: 'Comma-separated list of disallowed tools for the AI review'
|
|
required: false
|
|
default: ''
|
|
server:
|
|
description: 'Gitea server URL'
|
|
required: false
|
|
default: ''
|
|
repo_owner:
|
|
description: 'Repository owner (defaults to GITHUB_REPOSITORY owner)'
|
|
required: false
|
|
default: ''
|
|
repo_slug:
|
|
description: 'Repository slug/name (defaults to GITHUB_REPOSITORY name)'
|
|
required: false
|
|
default: ''
|
|
source_branch:
|
|
description: 'Source branch override (defaults to GITHUB_HEAD_REF)'
|
|
required: false
|
|
default: ''
|
|
source_commit:
|
|
description: 'Source commit SHA override'
|
|
required: false
|
|
default: ''
|
|
pr_id:
|
|
description: 'Pull Request ID override'
|
|
required: false
|
|
default: ''
|
|
pr_destination_branch:
|
|
description: 'PR destination/target branch override'
|
|
required: false
|
|
default: ''
|
|
pr_destination_commit:
|
|
description: 'PR destination commit SHA override'
|
|
required: false
|
|
default: ''
|
|
|
|
runs:
|
|
using: 'composite'
|
|
steps:
|
|
- name: Check condition
|
|
id: check
|
|
shell: bash
|
|
run: |
|
|
[[ "${{ github.event_name }}" == "pull_request" && "${{ contains(github.event.pull_request.title, '[no ai]') }}" == "false" ]] || \
|
|
[[ "${{ github.event_name }}" == "issues" && "${{ contains(github.event.issue.body, '@kodobot') }}" == "true" ]] || \
|
|
[[ "${{ github.event_name }}" == "issue_comment" && "${{ contains(github.event.comment.body, '@kodobot') }}" == "true" ]] && \
|
|
echo "run=true" >> $GITHUB_OUTPUT || echo "run=false" >> $GITHUB_OUTPUT
|
|
|
|
- name: Setup Repository Context
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Run Code Review
|
|
if: steps.check.outputs.run == 'true'
|
|
shell: bash
|
|
run: |
|
|
[ -n "${{ inputs.cc_base_url }}" ] && export CC_BASE_URL="${{ inputs.cc_base_url }}"
|
|
[ -n "${{ inputs.anthropic_api_key }}" ] && export CC_API_KEY="${{ inputs.anthropic_api_key }}"
|
|
[ -n "${{ inputs.model }}" ] && export CC_MODEL="${{ inputs.model }}"
|
|
[ -n "${{ inputs.cc_bgmodel }}" ] && export CC_BGMODEL="${{ inputs.cc_bgmodel }}"
|
|
[ -n "${{ inputs.cc_metric_url }}" ] && export CC_METRIC_URL="${{ inputs.cc_metric_url }}"
|
|
[ -n "${{ inputs.gitea_token }}" ] && export VCS_ACCESS_TOKEN="${{ inputs.gitea_token }}"
|
|
[ -n "${{ inputs.server }}" ] && export SERVER="${{ inputs.server }}"
|
|
[ -n "${{ inputs.enable_reviewer_verification }}" ] && export ENABLE_REVIEWER_VERIFICATION="${{ inputs.enable_reviewer_verification }}"
|
|
[ -n "${{ inputs.log_level }}" ] && export LOG_LEVEL="${{ inputs.log_level }}"
|
|
[ -n "${{ inputs.options_type }}" ] && export OPTIONS_TYPE="${{ inputs.options_type }}"
|
|
[ -n "${{ inputs.cc_prompt }}" ] && export CC_PROMPT="${{ inputs.cc_prompt }}"
|
|
[ -n "${{ inputs.cc_allowed_tool }}" ] && export CC_ALLOWED_TOOL="${{ inputs.cc_allowed_tool }}"
|
|
[ -n "${{ inputs.cc_disallowed_tool }}" ] && export CC_DISALLOWED_TOOL="${{ inputs.cc_disallowed_tool }}"
|
|
[ -n "${{ inputs.repo_owner }}" ] && export REPO_OWNER="${{ inputs.repo_owner }}"
|
|
[ -n "${{ inputs.repo_slug }}" ] && export REPO_SLUG="${{ inputs.repo_slug }}"
|
|
[ -n "${{ inputs.source_branch }}" ] && export SOURCE_BRANCH="${{ inputs.source_branch }}"
|
|
[ -n "${{ inputs.source_commit }}" ] && export SOURCE_COMMIT="${{ inputs.source_commit }}"
|
|
[ -n "${{ inputs.pr_id }}" ] && export PR_ID="${{ inputs.pr_id }}"
|
|
[ -n "${{ inputs.pr_destination_branch }}" ] && export PR_DESTINATION_BRANCH="${{ inputs.pr_destination_branch }}"
|
|
[ -n "${{ inputs.pr_destination_commit }}" ] && export PR_DESTINATION_COMMIT="${{ inputs.pr_destination_commit }}"
|
|
|
|
if [ -n "${{ inputs.team_name }}" ]; then
|
|
export TEAM_NAME="${{ inputs.team_name }}"
|
|
elif [ -z "$TEAM_NAME" ]; then
|
|
export TEAM_NAME="${{ github.repository_owner }}"
|
|
fi
|
|
|
|
/pipe.sh
|
|
|
|
branding:
|
|
icon: 'message-circle'
|
|
color: 'blue' |