好奇怪,为什么是未来时间! #69
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Copilot Help | |
| on: | |
| issues: | |
| types: [labeled] | |
| jobs: | |
| copilot-answer: | |
| if: github.event.label.name == 'help wanted' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Install Copilot CLI | |
| run: | | |
| curl -fsSL https://gh.io/copilot-install | bash | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - name: Generate response with Copilot CLI | |
| id: copilot | |
| env: | |
| GH_TOKEN: ${{ secrets.COPILOT_PAT }} | |
| run: | | |
| ISSUE_URL="${{ github.event.issue.html_url }}" | |
| PROMPT="You are an AI assistant bot for the project maintainer, helping to answer user questions and issues. | |
| Please read the GitHub issue at ${ISSUE_URL} including all comments. Analyze the entire conversation and provide helpful answers to any unresolved questions in the issue thread. | |
| Your role: | |
| - Act as a knowledgeable assistant representing the project maintainer | |
| - Provide accurate, helpful, and well-researched answers | |
| - Reference the codebase, documentation, and existing solutions when applicable | |
| - Be professional, friendly, and supportive | |
| - If you're uncertain about something, acknowledge it clearly | |
| Understanding comment authors: | |
| - When a comment's author is 'github-actions[bot]' or similar GitHub Action accounts, it indicates the comment was created and posted by AI. These are automated responses. | |
| - When a comment's author is 'stackia', it indicates the comment is from the project maintainer. These comments have high credibility and authority. | |
| - When someone manually @mentions you (the AI), pay special attention to whether they are asking you a question that requires a response or clarification. | |
| Avoiding redundancy: | |
| - Before responding, carefully review all previous comments, especially those from 'github-actions[bot]' (AI-generated responses). | |
| - Avoid repeating content that has already been covered by previous AI responses, unless the information is critically important and needs to be reiterated for emphasis or clarity. | |
| - If a question has already been adequately answered by a previous AI response, acknowledge that and only add new information or different perspectives if valuable. | |
| - Focus on providing new insights, updates, or addressing aspects that haven't been covered yet. | |
| Important instructions: | |
| 1. Your response must be in the same language as the primary language used in the issue discussion. For example, if the issue is discussed in Chinese, respond in Chinese. | |
| 2. After your analysis, output your final answer wrapped with special markers: | |
| - Start with: === FINAL ANSWER BEGIN === | |
| - End with: === FINAL ANSWER END === | |
| 3. The content between these markers should be the clean, well-formatted response to post as a GitHub issue comment." | |
| copilot -p "$PROMPT" --allow-all-tools --silent > response_raw.md | |
| # Extract content between markers | |
| sed -n '/=== FINAL ANSWER BEGIN ===/,/=== FINAL ANSWER END ===/p' response_raw.md | \ | |
| sed '1d;$d' > response.md | |
| - name: Post comment to issue | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh issue comment ${{ github.event.issue.number }} \ | |
| --repo ${{ github.repository }} \ | |
| --body-file response.md | |
| - name: Remove help wanted label | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh issue edit ${{ github.event.issue.number }} \ | |
| --repo ${{ github.repository }} \ | |
| --remove-label "help wanted" |