diff --git a/.github/workflows/triage-agent.yml b/.github/workflows/triage-agent.yml deleted file mode 100644 index 959d412d..00000000 --- a/.github/workflows/triage-agent.yml +++ /dev/null @@ -1,126 +0,0 @@ -name: AI Triage - -on: - issues: - types: [opened] - workflow_dispatch: - inputs: - issue_number: - description: 'Issue number to triage (manual run). e.g. 123' - required: true - -run-name: >- - AI Triage for Issue #${{ github.event.issue.number || github.event.inputs.issue_number }} - -permissions: - issues: write - contents: read - -jobs: - label_and_comment: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - - name: Get issue data - id: get_issue - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - with: - script: | - const eventName = context.eventName; - let issue; - if (eventName === 'workflow_dispatch') { - const inputs = context.payload.inputs || {}; - const issueNumber = inputs.issue_number || inputs.issueNumber; - if (!issueNumber) core.setFailed('Input issue_number is required for manual run.'); - const { data } = await github.rest.issues.get({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: parseInt(issueNumber, 10), - }); - issue = data; - } else if (context.payload.issue) { - issue = context.payload.issue; - } else { - core.setFailed('No issue information found in the event payload.'); - } - core.setOutput('id', String(issue.number)); - core.setOutput('user', String((issue.user && issue.user.login) || '')); - core.setOutput('title', String(issue.title || '')); - core.setOutput('body', String(issue.body || '')); - const labelNames = (issue.labels || []).map(label => label.name); - core.setOutput('labels', JSON.stringify(labelNames)); - - - name: Call Azure Function - id: call_azure_function - env: - PAYLOAD: >- - { - "authToken": "${{ secrets.GITHUB_TOKEN }}", - "repoId": "microsoft/vscode-java-debug", - "issueData": { - "id": ${{ steps.get_issue.outputs.id }}, - "user": ${{ toJson(steps.get_issue.outputs.user) }}, - "title": ${{ toJson(steps.get_issue.outputs.title) }}, - "body": ${{ toJson(steps.get_issue.outputs.body) }}, - "labels": ${{ steps.get_issue.outputs.labels }} - }, - "mode": "DirectUpdate" - } - - run: | - # Make the HTTP request with improved error handling and timeouts - echo "Making request to triage agent..." - - # Add timeout handling and better error detection - set +e # Don't exit on curl failure - response=$(timeout ${{ vars.TRIAGE_AGENT_TIMEOUT }} curl \ - --max-time 0 \ - --connect-timeout 30 \ - --fail-with-body \ - --silent \ - --show-error \ - --write-out "HTTPSTATUS:%{http_code}" \ - --header "Content-Type: application/json" \ - --request POST \ - --data "$PAYLOAD" \ - ${{ secrets.TRIAGE_FUNCTION_LINK }} 2>&1) - - curl_exit_code=$? - set -e # Re-enable exit on error - - echo "Curl exit code: $curl_exit_code" - - # Check if curl command timed out or failed - if [ $curl_exit_code -eq 124 ]; then - echo "❌ Request timed out after 650 seconds" - exit 1 - elif [ $curl_exit_code -ne 0 ]; then - echo "❌ Curl command failed with exit code: $curl_exit_code" - echo "Response: $response" - exit 1 - fi - - # Extract HTTP status code and response body - http_code=$(echo "$response" | grep -o "HTTPSTATUS:[0-9]*" | cut -d: -f2) - response_body=$(echo "$response" | sed 's/HTTPSTATUS:[0-9]*$//') - - echo "HTTP Status Code: $http_code" - - # Validate HTTP status code - if [ -z "$http_code" ]; then - echo "❌ Failed to extract HTTP status code from response" - echo "Raw response: $response" - exit 1 - fi - - # Check if the request was successful - if [ "$http_code" -ge 200 ] && [ "$http_code" -lt 300 ]; then - echo "✅ Azure Function call succeeded" - else - echo "❌ Azure Function call failed with status code: $http_code" - echo "Response: $response_body" - exit 1 - fi diff --git a/.github/workflows/triage-all-open-issues.yml b/.github/workflows/triage-all-open-issues.yml deleted file mode 100644 index 8b02df45..00000000 --- a/.github/workflows/triage-all-open-issues.yml +++ /dev/null @@ -1,145 +0,0 @@ -name: AI Triage - Process All Open Issues -on: - workflow_dispatch: - inputs: - dry_run: - description: 'Dry run mode - only list issues without processing' - required: false - default: false - type: boolean - max_issues: - description: 'Maximum number of issues to process (0 = all)' - required: false - default: '0' - type: string - -permissions: - issues: write - contents: read - actions: write - -jobs: - get_open_issues: - runs-on: ubuntu-latest - outputs: - issue_numbers: ${{ steps.get_issues.outputs.issue_numbers }} - total_count: ${{ steps.get_issues.outputs.total_count }} - - steps: - - name: Get all open issues - id: get_issues - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - with: - script: | - // Use Search API to filter issues at API level - const { data } = await github.rest.search.issuesAndPullRequests({ - q: `repo:${context.repo.owner}/${context.repo.repo} is:issue is:open -label:ai-triaged -label:invalid`, - sort: 'created', - order: 'desc', - per_page: 100 - }); - - const actualIssues = data.items; - - let issuesToProcess = actualIssues; - const maxIssues = parseInt('${{ inputs.max_issues }}' || '0'); - - if (maxIssues > 0 && actualIssues.length > maxIssues) { - issuesToProcess = actualIssues.slice(0, maxIssues); - console.log(`Limiting to first ${maxIssues} issues out of ${actualIssues.length} total`); - } - - const issueNumbers = issuesToProcess.map(issue => issue.number); - const totalCount = issuesToProcess.length; - - console.log(`Found ${actualIssues.length} open issues, processing ${totalCount}:`); - issuesToProcess.forEach(issue => { - console.log(` #${issue.number}: ${issue.title}`); - }); - - core.setOutput('issue_numbers', JSON.stringify(issueNumbers)); - core.setOutput('total_count', totalCount); - - process_issues: - runs-on: ubuntu-latest - needs: get_open_issues - if: needs.get_open_issues.outputs.total_count > 0 - - strategy: - # Process issues one by one (max-parallel: 1) - max-parallel: 1 - matrix: - issue_number: ${{ fromJSON(needs.get_open_issues.outputs.issue_numbers) }} - - steps: - - name: Log current issue being processed - run: | - echo "🔄 Processing issue #${{ matrix.issue_number }}" - echo "Total issues to process: ${{ needs.get_open_issues.outputs.total_count }}" - - - name: Check if dry run mode - if: inputs.dry_run == true - run: | - echo "🔍 DRY RUN MODE: Would process issue #${{ matrix.issue_number }}" - echo "Skipping actual triage processing" - - - name: Trigger triage workflow for issue - if: inputs.dry_run != true - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - with: - script: | - const issueNumber = '${{ matrix.issue_number }}'; - - try { - console.log(`Triggering triage workflow for issue #${issueNumber}`); - - const response = await github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'triage-agent.yml', - ref: 'main', - inputs: { - issue_number: issueNumber - } - }); - - console.log(`✅ Successfully triggered triage workflow for issue #${issueNumber}`); - - } catch (error) { - console.error(`❌ Failed to trigger triage workflow for issue #${issueNumber}:`, error); - core.setFailed(`Failed to process issue #${issueNumber}: ${error.message}`); - } - - - name: Wait for workflow completion - if: inputs.dry_run != true - run: | - echo "⏳ Waiting for triage workflow to complete for issue #${{ matrix.issue_number }}..." - echo "Timeout: ${{ vars.TRIAGE_AGENT_TIMEOUT }} seconds" - sleep ${{ vars.TRIAGE_AGENT_TIMEOUT }} # Wait for triage workflow completion - - summary: - runs-on: ubuntu-latest - needs: [get_open_issues, process_issues] - if: always() - - steps: - - name: Print summary - run: | - echo "## Triage Processing Summary" - echo "Total open issues found: ${{ needs.get_open_issues.outputs.total_count }}" - - if [ "${{ inputs.dry_run }}" == "true" ]; then - echo "Mode: DRY RUN (no actual processing performed)" - else - echo "Mode: FULL PROCESSING" - fi - - if [ "${{ needs.process_issues.result }}" == "success" ]; then - echo "✅ All issues processed successfully" - elif [ "${{ needs.process_issues.result }}" == "failure" ]; then - echo "❌ Some issues failed to process" - elif [ "${{ needs.process_issues.result }}" == "skipped" ]; then - echo "⏭️ Processing was skipped (no open issues found)" - else - echo "⚠️ Processing completed with status: ${{ needs.process_issues.result }}" - fi