diff --git a/.github/workflows/ai-on-demand.yaml b/.github/workflows/ai-on-demand.yaml deleted file mode 100644 index 372c305..0000000 --- a/.github/workflows/ai-on-demand.yaml +++ /dev/null @@ -1,92 +0,0 @@ -name: AI On-Demand Assistant -on: - issue_comment: - types: [created] - pull_request_review_comment: - types: [created] - pull_request_review: - types: [submitted] - issues: - types: [opened] - -jobs: - ai-response: - # Only run if the app is mentioned and it's not the app itself commenting - if: | - ( - (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@efp-dev-ops')) || - (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@efp-dev-ops')) || - (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@efp-dev-ops')) || - (github.event_name == 'issues' && contains(github.event.issue.body, '@efp-dev-ops')) - ) && contains(fromJSON(vars.ALLOWED_USER_LIST), github.actor) - runs-on: ubuntu-latest - permissions: - contents: read - issues: write - pull-requests: write - - steps: - - name: Checkout Code - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - name: Generate Custom App Token - id: generate-token - uses: actions/create-github-app-token@v1 - with: - app-id: ${{ secrets.APP_ID }} - private-key: ${{ secrets.PRIVATE_KEY }} - - - name: Extract Instruction from Comment - id: extract-instruction - env: - ISSUE_COMMENT_BODY: ${{ github.event.comment.body }} - PR_REVIEW_COMMENT_BODY: ${{ github.event.comment.body }} - PR_REVIEW_BODY: ${{ github.event.review.body }} - ISSUE_BODY: ${{ github.event.issue.body }} - run: | - # Get the comment body based on event type - if [ "${{ github.event_name }}" = "issue_comment" ]; then - COMMENT_BODY="$ISSUE_COMMENT_BODY" - elif [ "${{ github.event_name }}" = "pull_request_review_comment" ]; then - COMMENT_BODY="$PR_REVIEW_COMMENT_BODY" - elif [ "${{ github.event_name }}" = "pull_request_review" ]; then - COMMENT_BODY="$PR_REVIEW_BODY" - elif [ "${{ github.event_name }}" = "issues" ]; then - COMMENT_BODY="$ISSUE_BODY" - else - COMMENT_BODY="" - fi - - # Remove the @mention and get the instruction - INSTRUCTION=$(echo "$COMMENT_BODY" | sed 's/@efp-dev-ops[[:space:]]*//' | sed 's/^[[:space:]]*//') - - # Add input validation - if [ ${#INSTRUCTION} -gt 4000 ]; then - echo "Instruction too long, truncating..." - INSTRUCTION=$(echo "$INSTRUCTION" | head -c 4000) - fi - - # Set as output for next step - echo "instruction<> $GITHUB_OUTPUT - echo "$INSTRUCTION" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - - echo "Extracted instruction: $INSTRUCTION" - - - name: AI Response - uses: 0xthrpw/claude-code-action@v0.0.1 - continue-on-error: true - timeout-minutes: 10 - with: - claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} - github_token: ${{ steps.generate-token.outputs.token }} - direct_prompt: | - You are an AI assistant for our development team. A team member has requested help with the following: - - **User Request:** ${{ steps.extract-instruction.outputs.instruction }} - - Please provide a helpful, accurate response. If the request involves code analysis, focus on the current repository context. If it's a general question, provide clear and actionable guidance. - - Keep your response concise but thorough, and format it nicely for GitHub comments. diff --git a/.github/workflows/ai-on-demand.yml b/.github/workflows/ai-on-demand.yml new file mode 100644 index 0000000..6102c1f --- /dev/null +++ b/.github/workflows/ai-on-demand.yml @@ -0,0 +1,30 @@ +name: AI On-Demand Assistant +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + pull_request_review: + types: [submitted] + issues: + types: [opened] + +permissions: + contents: read + issues: write + pull-requests: write + actions: read + +jobs: + ai-response: + uses: ethereumfollowprotocol/workflow-automation/.github/workflows/issue-response.yml@v1.0.9 + with: + config-profile: "default" + bot-mention: "@efp-dev-ops" + enable-auto-labeling: true + enable-escalation: true + secrets: + CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.DEV_OPS_BOT_CLAUDE_CODE_OAUTH_TOKEN }} + APP_ID: ${{ secrets.DEV_OPS_BOT_APP_ID }} + PRIVATE_KEY: ${{ secrets.DEV_OPS_BOT_PRIVATE_KEY }} + ALLOWED_USER_LIST: ${{ secrets.DEV_OPS_BOT_ALLOWED_USER_LIST }} diff --git a/.github/workflows/ai-review.yaml b/.github/workflows/ai-review.yaml deleted file mode 100644 index f152d4a..0000000 --- a/.github/workflows/ai-review.yaml +++ /dev/null @@ -1,77 +0,0 @@ -name: Custom AI Code Review -on: - pull_request: - types: [opened, synchronize, reopened] -# issue_comment: -# types: [created] - -jobs: - ai-review: - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: write - issues: write - - steps: - - name: Checkout Code - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Get full history for better context - - - name: Generate Custom App Token - id: generate-token - uses: actions/create-github-app-token@v1 - with: - app-id: ${{ secrets.APP_ID }} - private-key: ${{ secrets.PRIVATE_KEY }} - - - name: AI Code Quality Review - uses: anthropics/claude-code-action@v0 - continue-on-error: true - timeout-minutes: 10 - with: - claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} - github_token: ${{ steps.generate-token.outputs.token }} - direct_prompt: | - You are the AI code quality reviewer for our organization. - - Please analyze this pull request for: - - ## 🔍 Code Quality Assessment - - Overall code quality rating (1-10) - - Code maintainability and readability - - Adherence to best practices - - Performance considerations - - ## 📚 Documentation Review - - Comment quality and completeness - - Function/method documentation - - README updates if needed - - ## 🎯 Specific Recommendations - - Actionable improvements with priorities - - Code refactoring suggestions - - Testing recommendations - - Format your response as a professional code review. - - - name: Post Summary Comment - continue-on-error: true - run: | - gh pr comment ${{ github.event.number }} --body " - ## 🤖 AI Code Review Complete - - Your custom AI assistant has completed the automated code review process. - - ✅ Security analysis finished - ✅ Code quality assessment complete - ✅ Documentation review done - - Please review the detailed feedback above and address any high-priority items before merging. - - --- - *This automated review was performed by EFP-DEV-OPS* - " - env: - GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} \ No newline at end of file diff --git a/.github/workflows/ai-review.yml b/.github/workflows/ai-review.yml new file mode 100644 index 0000000..9762add --- /dev/null +++ b/.github/workflows/ai-review.yml @@ -0,0 +1,21 @@ +name: AI Code Review +on: + pull_request: + types: [opened, synchronize, reopened] + +permissions: + contents: read + pull-requests: write + issues: write + actions: read + +jobs: + ai-review: + uses: ethereumfollowprotocol/workflow-automation/.github/workflows/pr-review.yml@v1.0.9 + with: + config-profile: "default" + secrets: + CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.DEV_OPS_BOT_CLAUDE_CODE_OAUTH_TOKEN }} + APP_ID: ${{ secrets.DEV_OPS_BOT_APP_ID }} + PRIVATE_KEY: ${{ secrets.DEV_OPS_BOT_PRIVATE_KEY }} + ALLOWED_USER_LIST: ${{ secrets.DEV_OPS_BOT_ALLOWED_USER_LIST }} \ No newline at end of file