기존 GitHub Actions 워크플로우(코드) 분석 #2

Closed
opened 2024-12-27 23:49:09 +09:00 by mschoi · 2 comments
Owner

Github action 으로 Code Review하는 코드 확인
Workflow와 과정에 필요한 API 분석.

Github action 으로 Code Review하는 코드 확인 Workflow와 과정에 필요한 API 분석.
mschoi added this to the 요구사항 정리 및 초기 설계 milestone 2024-12-27 23:49:09 +09:00
Author
Owner
  1. OpenAI, Claude token / Model name
  • I want to use OpenAI o1 model for total code review.
  • and Claude Sonnet 3.5 model for each code block.
  1. Github Repository token - It should only need repo access.
  2. exclude option
  3. How to make actions
  4. Get PR details
  • content - owner, repo, pull_number, title, description
  • Github event path - repository, number
  • get diff from pull / parsing contents.
  • When synchronize - get only current sha.
  1. Prompt
  2. AI response
  3. Create comment / Post comment
1. OpenAI, Claude token / Model name - I want to use OpenAI o1 model for total code review. - and Claude Sonnet 3.5 model for each code block. 2. Github Repository token - It should only need repo access. 3. exclude option 4. How to make actions 5. Get PR details - content - owner, repo, pull_number, title, description - Github event path - repository, number - get diff from pull / parsing contents. - When synchronize - get only current sha. 6. Prompt 7. AI response 8. Create comment / Post comment
Author
Owner

To-Do List for Refactoring the Code to Include Gitea API and Claude API

  1. Setup and Initialization

    • Replace GitHub API (octokit) with Gitea API.
    • Replace OpenAI API (openai) with Claude API.
    • Configure authentication for Gitea and Claude APIs using environment variables.
    • Update dependency imports to reflect the new APIs.
  2. PR Details Fetching

    • Adapt the get_pr_details function to fetch PR details using Gitea API.
    • Ensure compatibility with Gitea’s pull request metadata (e.g., owner, repo, title, description, pull number).
  3. Fetching Code Diff

    • Update the get_diff function to fetch PR diffs using Gitea’s API.
    • Ensure proper handling of diff formatting and content parsing.
  4. Prompt Creation for Claude API

    • Adjust the create_prompt function for compatibility with Claude API’s expected input format.
    • Verify the instruction clarity for Claude, including structure and JSON response requirements.
  5. Claude API Integration

    • Replace the get_ai_response function to interact with Claude API.
    • Handle Claude’s response parsing and ensure JSON format consistency.
  6. Parsing and Filtering Diff

    • Adapt diff parsing logic to fit Gitea’s diff structure.
    • Ensure the exclusion patterns (minimatch) work correctly with Gitea file paths.
  7. Analyzing Code and Generating Comments

    • Refactor analyze_code to process parsed diffs and integrate responses from Claude.
    • Ensure file paths and line numbers match Gitea’s PR review structure.
  8. Posting Review Comments

    • Update create_review_comment to use Gitea’s API for posting review comments.
    • Verify comment format and attachment to the correct lines/files.
  9. Event Handling

    • Adapt event handling (opened, synchronize) to Gitea webhook events.
    • Update comparison logic for base and head commits using Gitea API.
  10. Environment and Configuration

    • Update configuration documentation for Gitea and Claude API credentials.
    • Validate all environment variables and fallback defaults.
To-Do List for Refactoring the Code to Include Gitea API and Claude API 1. Setup and Initialization - [x] Replace GitHub API (octokit) with Gitea API. - [x] Replace OpenAI API (openai) with Claude API. - [x] Configure authentication for Gitea and Claude APIs using environment variables. - [x] Update dependency imports to reflect the new APIs. 2. PR Details Fetching - [x] Adapt the get_pr_details function to fetch PR details using Gitea API. - [x] Ensure compatibility with Gitea’s pull request metadata (e.g., owner, repo, title, description, pull number). 3. Fetching Code Diff - [x] Update the get_diff function to fetch PR diffs using Gitea’s API. - [x] Ensure proper handling of diff formatting and content parsing. 4. Prompt Creation for Claude API - [x] Adjust the create_prompt function for compatibility with Claude API’s expected input format. - [x] Verify the instruction clarity for Claude, including structure and JSON response requirements. 5. Claude API Integration - [x] Replace the get_ai_response function to interact with Claude API. - [x] Handle Claude’s response parsing and ensure JSON format consistency. 6. Parsing and Filtering Diff - [x] Adapt diff parsing logic to fit Gitea’s diff structure. - [x] Ensure the exclusion patterns (minimatch) work correctly with Gitea file paths. 7. Analyzing Code and Generating Comments - [x] Refactor analyze_code to process parsed diffs and integrate responses from Claude. - [x] Ensure file paths and line numbers match Gitea’s PR review structure. 8. Posting Review Comments - [x] Update create_review_comment to use Gitea’s API for posting review comments. - [x] Verify comment format and attachment to the correct lines/files. 9. Event Handling - [x] Adapt event handling (opened, synchronize) to Gitea webhook events. - [x] Update comparison logic for base and head commits using Gitea API. 10. Environment and Configuration - [x] Update configuration documentation for Gitea and Claude API credentials. - [x] Validate all environment variables and fallback defaults.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mschoi/CodeReviewer#2