-
-
Notifications
You must be signed in to change notification settings - Fork 509
138 lines (114 loc) · 5.08 KB
/
issue-triage.yaml
File metadata and controls
138 lines (114 loc) · 5.08 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Issue Triage
on:
issues:
types: [opened]
jobs:
triage:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Triage new issue
uses: actions/github-script@v7
with:
script: |
const body = context.payload.issue.body || '';
const labels = context.payload.issue.labels.map(l => l.name);
// Skip if this is a feature request or already labeled
if (labels.includes('enhancement')) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['triage-pending']
});
return;
}
// Check for clipboard paste issue (VS Code Issue Reporter without pasted content)
const clipboardPattern = /^We have written the needed data into your clipboard because it was too large to send\. Please paste\.$/;
if (clipboardPattern.test(body.trim())) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['invalid']
});
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `## Issue Incomplete
It looks like you used the **VS Code Issue Reporter** but didn't paste the generated content.
### What happened
VS Code copied diagnostic information to your clipboard, but it wasn't pasted into this issue.
### What to do
1. Close this issue
2. Open a new issue using our [bug report template](https://github.com/prettier/prettier-vscode/issues/new?template=bug_report.yaml)
3. Paste the clipboard content when prompted
Thanks for your understanding!`
});
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
state: 'closed'
});
return;
}
// Check for missing or invalid reproduction repository (bug reports only)
const repoFieldMatch = body.match(/### Reproduction Repository\s*\n\s*\n([^\n]+)/i);
const repoUrl = repoFieldMatch ? repoFieldMatch[1].trim() : '';
const invalidRepoPatterns = [
/^n\/?a$/i,
/^none$/i,
/^no$/i,
/^-+$/,
/^\.+$/,
/^https?:\/\/github\.com\/(?:username|user[-_]name|your[-_]?username|yourusername)\//i,
/^https?:\/\/github\.com\/[^/]+\/repo-name/i,
/^_no response_$/i,
/^\s*$/
];
const hasValidRepo = repoUrl &&
repoUrl.match(/^https?:\/\/github\.com\/[^/]+\/[^/]+/) &&
!invalidRepoPatterns.some(p => p.test(repoUrl));
// If this looks like a bug report without a valid repo
const isBugReport = body.includes('### Issue Summary') ||
body.includes('### Steps to Reproduce') ||
labels.includes('bug');
if (isBugReport && !hasValidRepo) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['need-more-info']
});
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `## Reproduction Repository Required
Thanks for opening this issue! To help us investigate, we need a **reproduction repository**.
### Why we need this
Most issues are configuration-specific. Without a repo we can clone and test, we usually cannot diagnose the problem.
### How to create a reproduction
1. Create a new **public GitHub repository**
2. Add the minimum files needed to reproduce the issue
3. Include a \`.prettierrc\` or other config files you're using
4. Edit this issue and add the repository link
> **Tip:** The simpler the reproduction, the faster we can help!
### What happens next
- **With a repo:** We'll investigate and respond
- **Without a repo:** This issue will be automatically closed in 7 days
### Resources
- [How to create a minimal reproduction](https://github.com/prettier/prettier-vscode/blob/main/docs/troubleshooting.md)
- [Writing a good issue](https://github.com/prettier/prettier-vscode/blob/main/docs/writing-an-issue.md)`
});
}
// Add triage label for AI assessment
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['triage-pending']
});