Repository navigation
108 lines (95 loc) · 3.49 KB
/
Copy pathtriage.yml
File metadata and controls
108 lines (95 loc) · 3.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: "Issue triage"
on:
# Opt in by applying the "needs-triage" label; re-apply it to trigger another pass.
issues:
types: [labeled]
workflow_dispatch:
inputs:
issue:
description: "Issue number to triage"
required: true
permissions: {}
jobs:
triage:
if: >-
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'issues' && github.event.label.name == 'needs-triage')
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
copilot-requests: write
outputs:
has_draft: ${{ steps.triage.outputs.has_draft }}
env:
ISSUE: ${{ github.event.issue.number || inputs.issue }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: lts/*
- name: Install Copilot CLI
run: npm install -g @github/copilot
- name: Triage issue with Copilot CLI
id: triage
env:
COPILOT_GITHUB_TOKEN: ${{ github.token }}
run: |
mkdir -p output
PROMPT=$(cat <<EOF
Triage https://github.com/${{ github.repository }}/issues/$ISSUE using the playwright-triage skill.
The GitHub CLI is not authenticated in this job. Do not run gh; use GitHub MCP tools
for all GitHub reads.
Do not post anything yourself. Write the comment to output/triage.md and a later step posts it.
EOF
)
copilot \
--allow-all-tools \
--allow-all-paths \
--no-ask-user \
--enable-all-github-mcp-tools \
--share=output/copilot-session.md \
--model claude-opus-4.8 \
--max-ai-credits 500 \
-p "$PROMPT"
if [ -s output/triage.md ]; then
echo "has_draft=true" >> "$GITHUB_OUTPUT"
else
echo "has_draft=false" >> "$GITHUB_OUTPUT"
fi
- name: Add session transcript to job summary
if: always()
run: |
{
echo "## Triage session transcript (issue $ISSUE)"
echo ''
cat "output/copilot-session.md" 2>/dev/null || echo "(no transcript)"
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload output
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: triage-${{ github.event.issue.number || inputs.issue }}
path: output/triage.md
if-no-files-found: warn
post:
needs: triage
if: needs.triage.outputs.has_draft == 'true'
runs-on: ubuntu-latest
permissions:
issues: write
env:
ISSUE: ${{ github.event.issue.number || inputs.issue }}
GH_TOKEN: ${{ github.token }}
WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
steps:
- name: Download triage output
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: triage-${{ github.event.issue.number || inputs.issue }}
path: output
- name: Post triage comment
run: |
printf '\n\n<sub>Triaged by the Playwright bot - [agent run](%s)</sub>\n<!-- playwright-ai-triage -->\n' "$WORKFLOW_URL" >> output/triage.md
gh issue comment "$ISSUE" --repo "${{ github.repository }}" --body-file output/triage.md