diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index f51cdd29..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - ---- - - - - - -**Environment (please complete the following information):** - - OS (*e.g.,* Windows 10): - - Extension version (*e.g.,* 1.2.3): - - -**Describe the bug:** - - -**Repro steps:** - - -**Expected behavior:** - - -**Additional context:** - diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000..8d5c08f8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,84 @@ +name: Bug report +description: Report a problem with Microsoft Edge Tools for VS Code +title: "[Bug] " +labels: + - bug +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to report a problem. + + Before submitting, search existing issues to avoid creating a duplicate and review the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). + + - type: input + id: operating-system + attributes: + label: Operating system + description: Include the operating system name and version. + placeholder: Windows 11 24H2 + validations: + required: true + + - type: input + id: extension-version + attributes: + label: Extension version + description: Find this by selecting Microsoft Edge Tools in the VS Code Extensions view. + placeholder: 2.1.11 + validations: + required: true + + - type: input + id: vscode-version + attributes: + label: Visual Studio Code version + description: Find this under Help > About. + placeholder: 1.136.0 + validations: + required: true + + - type: textarea + id: bug-description + attributes: + label: Bug description + description: Clearly describe what went wrong. + placeholder: Describe the problem and when it occurs. + validations: + required: true + + - type: textarea + id: steps-to-reproduce + attributes: + label: Steps to reproduce + description: Provide the smallest sequence of steps that reproduces the problem. + placeholder: | + 1. Open ... + 2. Select ... + 3. Observe ... + validations: + required: true + + - type: textarea + id: expected-behavior + attributes: + label: Expected behavior + description: Describe what you expected to happen. + validations: + required: true + + - type: textarea + id: additional-context + attributes: + label: Additional context + description: Add logs, screenshots, or other relevant details. Remove sensitive information first. + + - type: checkboxes + id: checks + attributes: + label: Submission checks + options: + - label: I searched existing issues and did not find a duplicate. + required: true + - label: I have provided enough information for someone else to reproduce or investigate the problem. + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..3ba13e0c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index f54780f2..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - - - - - -**Is your feature request related to a problem? Please describe.** - - -**Describe the solution you'd like:** - - -**Describe alternatives you've considered:** - - -**Additional context:** - diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 00000000..3d546b89 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,51 @@ +name: Feature request +description: Suggest an improvement to Microsoft Edge Tools for VS Code +title: "[Feature] " +labels: + - enhancement +body: + - type: markdown + attributes: + value: | + Thanks for suggesting an improvement. + + Before submitting, search existing issues to avoid creating a duplicate and review the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). + + - type: textarea + id: problem + attributes: + label: Problem + description: Describe the developer problem or limitation this request would address. + placeholder: I am unable to ... because ... + validations: + required: true + + - type: textarea + id: proposed-solution + attributes: + label: Proposed solution + description: Describe the behavior or experience you would like. + validations: + required: true + + - type: textarea + id: alternatives + attributes: + label: Alternatives considered + description: Describe any workarounds or alternative solutions you have tried. + + - type: textarea + id: additional-context + attributes: + label: Additional context + description: Add screenshots, examples, or other relevant details. + + - type: checkboxes + id: checks + attributes: + label: Submission checks + options: + - label: I searched existing issues and did not find a duplicate. + required: true + - label: This request is specifically about Microsoft Edge Tools for VS Code. + required: true diff --git a/.github/workflows/validate-issue.yml b/.github/workflows/validate-issue.yml new file mode 100644 index 00000000..5506078c --- /dev/null +++ b/.github/workflows/validate-issue.yml @@ -0,0 +1,128 @@ +name: Validate issue submission + +on: + issues: + types: + - opened + +permissions: + contents: read + issues: write + +jobs: + validate: + if: >- + contains(github.event.issue.labels.*.name, 'bug') || + contains(github.event.issue.labels.*.name, 'enhancement') + runs-on: ubuntu-latest + steps: + - name: Close clearly incomplete submissions + uses: actions/github-script@v9 + with: + script: | + const association = context.payload.issue.author_association; + if (['OWNER', 'MEMBER', 'COLLABORATOR'].includes(association)) { + return; + } + + const issue = context.payload.issue; + const labelNames = issue.labels.map(label => + typeof label === 'string' ? label : label.name + ); + const isBug = labelNames.includes('bug'); + const requiredSections = isBug + ? [ + 'Operating system', + 'Extension version', + 'Visual Studio Code version', + 'Bug description', + 'Steps to reproduce', + 'Expected behavior', + ] + : ['Problem', 'Proposed solution']; + + const sections = new Map(); + let currentSection; + for (const line of (issue.body || '').split(/\r?\n/)) { + const heading = line.match(/^###\s+(.+?)\s*$/); + if (heading) { + currentSection = heading[1]; + sections.set(currentSection, []); + } else if (currentSection) { + sections.get(currentSection).push(line); + } + } + + const values = requiredSections.map(section => { + const lines = sections.get(section); + return lines ? lines.join('\n').trim() : undefined; + }); + const junkValues = new Set([ + '', + '-', + '.', + 'n/a', + 'na', + 'none', + 'no', + 'test', + 'testing', + 'todo', + '_no response_', + ]); + const isJunk = value => { + if (value === undefined) { + return true; + } + + const normalized = value.toLowerCase().trim(); + return junkValues.has(normalized) || + normalized.length < 3 || + /^([^\p{L}\p{N}])\1*$/u.test(normalized) || + /^([\p{L}\p{N}])\1{2,}$/u.test(normalized); + }; + + const missingCount = values.filter(value => value === undefined).length; + const junkCount = values.filter(isJunk).length; + + // Be deliberately conservative: close only malformed form submissions + // or submissions with multiple unmistakably meaningless answers. + const invalid = missingCount > 0 || junkCount >= 2; + if (!invalid) { + return; + } + + const labels = [...new Set([...labelNames, 'invalid'])]; + await github.rest.issues.update({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue.number, + state: 'closed', + state_reason: 'not_planned', + labels, + }); + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue.number, + body: [ + 'Closing this as it does not contain enough information to investigate.', + '', + 'If this is a genuine request for Microsoft Edge Tools for VS Code, please open a new issue and complete all required fields with meaningful details.', + '', + ...(isBug + ? [ + '- Your operating system, VS Code version, and extension version', + '- A clear description of the bug', + '- Steps to reproduce', + '- Expected behavior', + ] + : [ + '- The developer problem or limitation', + '- The behavior or solution you are proposing', + ]), + '', + 'Thanks!', + ].join('\n'), + }); diff --git a/package.json b/package.json index a7879a5c..d75917c8 100644 --- a/package.json +++ b/package.json @@ -615,11 +615,11 @@ }, { "view": "vscode-edge-devtools-view.help-links", - "contents": "[Report a Bug](https://github.com/microsoft/vscode-edge-devtools/issues/new?template=bug_report.md)" + "contents": "[Report a Bug](https://github.com/microsoft/vscode-edge-devtools/issues/new?template=bug_report.yml)" }, { "view": "vscode-edge-devtools-view.help-links", - "contents": "[Request a Feature](https://github.com/microsoft/vscode-edge-devtools/issues/new?template=feature_request.md)" + "contents": "[Request a Feature](https://github.com/microsoft/vscode-edge-devtools/issues/new?template=feature_request.yml)" } ] }, diff --git a/src/devtoolsPanel.ts b/src/devtoolsPanel.ts index b6b4194c..1574021f 100644 --- a/src/devtoolsPanel.ts +++ b/src/devtoolsPanel.ts @@ -631,7 +631,7 @@ export class DevToolsPanel {
If this problem continues, please file an issue.
+If this problem continues, please file an issue.