|
| 1 | +# Similar to the Copilot Triage Agent |
| 2 | +name: Copilot Issue Helper |
| 3 | + |
| 4 | +on: |
| 5 | + issues: |
| 6 | + types: [opened, edited, reopened] |
| 7 | + |
| 8 | +permissions: |
| 9 | + issues: write |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + process_issue: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Summarize issue with Copilot |
| 18 | + id: summary |
| 19 | + uses: github/copilot-actions/summarize@v1 |
| 20 | + with: |
| 21 | + text: | |
| 22 | + Title: ${{ github.event.issue.title }} |
| 23 | + Body: ${{ github.event.issue.body }} |
| 24 | +
|
| 25 | + - name: Suggest labels with Copilot |
| 26 | + id: labels |
| 27 | + uses: github/copilot-actions/label@v1 |
| 28 | + with: |
| 29 | + text: | |
| 30 | + Title: ${{ github.event.issue.title }} |
| 31 | + Body: ${{ github.event.issue.body }} |
| 32 | +
|
| 33 | + - name: Apply labels |
| 34 | + uses: actions/github-script@v7 |
| 35 | + with: |
| 36 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 37 | + script: | |
| 38 | + const labels = ${{ steps.labels.outputs.labels }}; |
| 39 | + if (labels && labels.length > 0) { |
| 40 | + await github.rest.issues.addLabels({ |
| 41 | + owner: context.repo.owner, |
| 42 | + repo: context.repo.repo, |
| 43 | + issue_number: context.issue.number, |
| 44 | + labels |
| 45 | + }); |
| 46 | + } |
| 47 | +
|
| 48 | + - name: Comment summary |
| 49 | + uses: actions/github-script@v7 |
| 50 | + with: |
| 51 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 52 | + script: | |
| 53 | + await github.rest.issues.createComment({ |
| 54 | + owner: context.repo.owner, |
| 55 | + repo: context.repo.repo, |
| 56 | + issue_number: context.issue.number, |
| 57 | + body: [ |
| 58 | + "### 🤖 Copilot Summary", |
| 59 | + "", |
| 60 | + `${{ steps.summary.outputs.summary }}`, |
| 61 | + "", |
| 62 | + "_Generated automatically by Copilot Actions._" |
| 63 | + ].join("\n") |
| 64 | + }) |
0 commit comments