Skip to content

Code Refactor

Code Refactor #10

Workflow file for this run

name: Code Refactor
on:
workflow_dispatch: # Triggered manually through the GitHub UI
inputs:
cr_type:
type: choice
description: 'Type of action to perform'
required: true
default: 'review'
options:
- refactor
- review
- document
target_branch:
description: 'Target Branch'
required: true
target_files:
type: string
description: 'Optional: Comma separated list of files to target, relative to the repository root. If not specified, all files in the Target Branch will be targeted.'
required: false
open_ai_model:
type: choice
description: Which OpenAI model to use
options:
- gpt-4
- gpt-4-32k
- gpt-3.5-turbo
- gpt-3.5-turbo-16k
default: gpt-3.5-turbo
model_temperature:
type: number
description: 'Model Temperature'
required: true
default: 0.0
max_supported_tokens:
type: number
description: 'Maximum total tokens you want the model to use (prompt and completion)'
required: true
default: 4096
max_completion_tokens:
type: number
description: 'Maximum number of completion tokens you want the model to use. Must be smaller than max_supported_tokens.'
required: true
default: 2048
log_level:
description: 'Log level'
required: true
default: 'info'
type: choice
options:
- info
- warning
- debug
jobs:
code_review:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Start code review step
id: code_review
uses: aronweiler/codereviewer@main
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CR_PROVIDER: "github"
CR_MODEL: ${{ inputs.open_ai_model }}
CR_TEMPERATURE: ${{ inputs.model_temperature }}
CR_MAX_SUPPORTED_TOKENS: ${{ inputs.max_supported_tokens }}
CR_MAX_COMPLETION_TOKENS: ${{ inputs.max_completion_tokens }}
CR_LOG_LEVEL: ${{ inputs.log_level }}
CR_SOURCE_BRANCH: ${{ github.ref_name }}
CR_TARGET_BRANCH: ${{ inputs.target_branch }}
CR_TYPE: ${{ inputs.cr_type }}
CR_TARGET_FILES: ${{ inputs.target_files }}