| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- name: Auto Reply to Issues
- on:
- issues:
- types: [labeled]
- permissions:
- issues: write
- contents: read
- # Limit concurrent runs to prevent rate limit issues
- concurrency:
- group: auto-reply-${{ github.event.issue.number }}
- cancel-in-progress: false
- jobs:
- auto-reply:
- # Only trigger when 'ai-reply' label is added; skip bot-created issues and issues already labeled 'copilot'
- if: |
- github.event.label.name == 'ai-reply' &&
- github.event.issue.user.login != 'github-actions[bot]' &&
- !contains(github.event.issue.labels.*.name, 'copilot')
- runs-on: ubuntu-latest
- # Increased timeout to 10 minutes to accommodate multiple API calls, file I/O, and network latency.
- timeout-minutes: 10
-
- steps:
- - uses: actions/checkout@v4
-
- - name: Build Repository Index
- id: repo_index
- run: |
- echo "Building repository index from AGENTS.md..."
-
- # Verify AGENTS.md exists
- if [ ! -f "AGENTS.md" ]; then
- echo "Error: AGENTS.md not found"
- exit 1
- fi
-
- # Extract sections 1-3 from AGENTS.md (up to but not including "## Development Guide")
- # This covers: Project Overview, Project Architecture, and Getting Started
- awk '/^## Development Guide/{exit} {print}' AGENTS.md > /tmp/repo_index.md
-
- # Verify extraction was successful (file should not be empty)
- if [ ! -s "/tmp/repo_index.md" ]; then
- echo "Error: Failed to extract content from AGENTS.md"
- exit 1
- fi
-
- echo "Repository index built successfully ($(wc -l < /tmp/repo_index.md) lines)"
-
- - name: Multi-turn AI Response
- id: ai_response
- uses: actions/github-script@v8
- with:
- github-token: ${{ secrets.GITHUB_TOKEN }}
- script: |
- const fs = require('fs');
- const path = require('path');
- const script = require('./.github/scripts/issue-ai-response.js');
- await script({ github, context, core, fs, path });
- env:
- OPENAI_URL: ${{ vars.OPENAI_URL }}
- OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
|