diff --git a/.github/actions/aicoder/action.yml b/.github/actions/aicoder/action.yml deleted file mode 100644 index af52745..0000000 --- a/.github/actions/aicoder/action.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: 'AICoder GH Action' -description: 'A GitHub action that uses AICoder to generate PRs improving the code of files absed on prompts' -author: 'carlospolop' -inputs: - INPUT_MODE: - description: 'Mode of operation' - required: true - INPUT_PROMPT: - description: 'Prompt for the AI' - required: false - INPUT_API_KEY: - description: 'OpenAI API Key' - required: true - INPUT_MODEL: - description: 'Model to use for AI' - required: false - TEMPLATE_FILES: - description: 'Template files for file-generator mode' - required: false - CHECK_PATH: - description: 'Path to file/folder to modify' - required: false - ORIGIN_BRANCH: - description: 'Origin branch to checkout' - required: true - TO_BRANCH: - description: 'Branch to commit changes' - required: true -runs: - using: 'composite' - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - name: Install dependencies - run: pip3 install aicoder - shell: bash - - name: Run AI Coder - run: python3 gh-aicoder.py - env: - INPUT_MODE: ${{ inputs.INPUT_MODE }} - INPUT_PROMPT: ${{ inputs.INPUT_PROMPT }} - INPUT_API_KEY: ${{ inputs.INPUT_API_KEY }} - INPUT_MODEL: ${{ inputs.INPUT_MODEL }} - TEMPLATE_FILES: ${{ inputs.TEMPLATE_FILES }} - ORIGIN_BRANCH: ${{ inputs.ORIGIN_BRANCH }} - TO_BRANCH: ${{ inputs.TO_BRANCH }} - CHECK_PATH: ${{ inputs.CHECK_PATH }} - shell: bash - diff --git a/.github/actions/aicoder/gh-aicoder.py b/.github/actions/aicoder/gh-aicoder.py deleted file mode 100644 index ce0a678..0000000 --- a/.github/actions/aicoder/gh-aicoder.py +++ /dev/null @@ -1,47 +0,0 @@ -import subprocess -import os - -# https://docs.github.com/en/actions/learn-github-actions/finding-and-customizing-actions -def main(mode, prompt, api_key, model, path, template_files): - - # Get inputs from env variables - mode = os.environ.get("INPUT_MODE").lower() - prompt = os.environ.get("INPUT_PROMPT", "") - api_key = os.environ.get("INPUT_API_KEY") - model = os.environ.get("INPUT_MODEL", "gpt-4") - path = os.environ.get("CHECK_PATH", "") - template_files = os.environ.get("TEMPLATE_FILES", "") - orig_branch = os.environ.get("ORIGIN_BRANCH", "") - to_branch = os.environ.get("TO_BRANCH", "") - - #Allowed modes - allowed_modes = ["file-enhancer", "file-generator", "file-security", "file-optimizer", "file-comments", "file-bugfixer"] - if mode not in allowed_modes: - raise ValueError(f"Mode must be one of {allowed_modes}") - - # Construct the aicoder command based on the mode - command = [ - "aicoder", - mode, - "--prompt", prompt, - "--api-key", api_key, - "--model", model, - "--orig-branch", orig_branch, - "--to-branch", to_branch - ] - - if path: - command.extend(["--path", path]) - elif template_files: - command.extend(["--template-files", template_files]) - else: - raise ValueError("Either path or template_files must be provided") - - if path and template_files: - raise ValueError("Either path or template_files must be provided") - - if template_files and mode != "file-generator": - raise ValueError("template_files can only be used with file-generator mode") - - # Run the command - subprocess.run(command)