Skip to content

Showing Activating only #53

Showing Activating only

Showing Activating only #53

Workflow file for this run

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@v8
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']
});