|
| 1 | +name: Issue Triage with Copilot |
| 2 | + |
| 3 | +# ============================================================================= |
| 4 | +# TRIGGER CONFIGURATION |
| 5 | +# This workflow runs automatically when a new issue is opened in the repository |
| 6 | +# ============================================================================= |
| 7 | +on: |
| 8 | + issues: |
| 9 | + types: |
| 10 | + - opened |
| 11 | + |
| 12 | +jobs: |
| 13 | + triage-non-blazor-issue: |
| 14 | + # =========================================================================== |
| 15 | + # JOB FILTER CONDITION |
| 16 | + # Only run this job for issues that: |
| 17 | + # 1. Reference ASP.NET Core documentation (must contain aspnetcore/ path) |
| 18 | + # 2. Are NOT related to Blazor content (excludes blazor/ folder) |
| 19 | + # 3. Are NOT related to Blazor-adjacent content (excludes specific |
| 20 | + # client-side interop and component tag helper docs that are |
| 21 | + # Blazor-related but located outside the blazor/ folder) |
| 22 | + # =========================================================================== |
| 23 | + if: | |
| 24 | + contains(github.event.issue.body, 'https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/') |
| 25 | + && !contains(github.event.issue.body, 'https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor') |
| 26 | + && !contains(github.event.issue.body, 'https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/client-side/dotnet-interop/index.md') |
| 27 | + && !contains(github.event.issue.body, 'https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/client-side/dotnet-interop/wasm-browser-app.md') |
| 28 | + && !contains(github.event.issue.body, 'https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/client-side/dotnet-on-webworkers.md') |
| 29 | + && !contains(github.event.issue.body, 'https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/mvc/views/tag-helpers/built-in/component-tag-helper.md') |
| 30 | + && !contains(github.event.issue.body, 'https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/mvc/views/tag-helpers/built-in/persist-component-state.md') |
| 31 | + runs-on: ubuntu-latest |
| 32 | + |
| 33 | + # =========================================================================== |
| 34 | + # PERMISSIONS |
| 35 | + # - issues: write - Required to post comments and add labels to issues |
| 36 | + # - contents: read - Required to checkout the repository and read agent file |
| 37 | + # - pull-requests: read - Required for Copilot action to access PR context that may be referred to in the issue. |
| 38 | + # =========================================================================== |
| 39 | + permissions: |
| 40 | + issues: write |
| 41 | + contents: read |
| 42 | + pull-requests: read |
| 43 | + steps: |
| 44 | + # ========================================================================= |
| 45 | + # STEP 1: POST WELCOME MESSAGE |
| 46 | + # Immediately acknowledge the issue with a friendly welcome message |
| 47 | + # to let the submitter know their issue has been received |
| 48 | + # ========================================================================= |
| 49 | + - name: Post welcome message |
| 50 | + uses: actions/github-script@v6 |
| 51 | + with: |
| 52 | + script: | |
| 53 | + await github.rest.issues.createComment({ |
| 54 | + issue_number: context.issue.number, |
| 55 | + owner: context.repo.owner, |
| 56 | + repo: context.repo.repo, |
| 57 | + body: `### 👋 ***Thanks for your issue!*** 😊\n\nWe will be along shortly to assist.` |
| 58 | + }) |
| 59 | +
|
| 60 | + # ========================================================================= |
| 61 | + # STEP 2: CHECKOUT REPOSITORY |
| 62 | + # Clone the repository to access the Copilot agent configuration file |
| 63 | + # located at .github/agents/issue-triage-nonblazor.agent.md |
| 64 | + # ========================================================================= |
| 65 | + - name: Checkout repository |
| 66 | + uses: actions/checkout@v4 |
| 67 | + |
| 68 | + # ========================================================================= |
| 69 | + # STEP 3: RUN COPILOT AI TRIAGE |
| 70 | + # Execute the Copilot action with the non-Blazor triage agent to: |
| 71 | + # - Analyze the issue content |
| 72 | + # - Generate a triage report with recommendations |
| 73 | + # - Post the analysis as a comment on the issue |
| 74 | + # ========================================================================= |
| 75 | + - name: Run Copilot Issue Triage |
| 76 | + uses: github/copilot-action@v1 |
| 77 | + with: |
| 78 | + agent: .github/agents/issue-triage-nonblazor.agent.md |
| 79 | + prompt: | |
| 80 | + Analyze issue #${{ github.event.issue.number }} and post your triage report as a comment on the issue. |
| 81 | + Issue URL: ${{ github.event.issue.html_url }} |
| 82 | + env: |
| 83 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 84 | + # ========================================================================= |
| 85 | + # STEP 4: ADD TRIAGE LABEL |
| 86 | + # Apply the "ai-triage-action-plan" label to indicate this issue has been |
| 87 | + # processed by the AI triage workflow and has an action plan generated |
| 88 | + # ========================================================================= |
| 89 | + - name: Add triage label |
| 90 | + uses: actions/github-script@v6 |
| 91 | + with: |
| 92 | + script: | |
| 93 | + await github.rest.issues.addLabels({ |
| 94 | + issue_number: context.issue.number, |
| 95 | + owner: context.repo.owner, |
| 96 | + repo: context.repo.repo, |
| 97 | + labels: ["ai-triage-action-plan"] |
| 98 | + }) |
0 commit comments