From 914a33426aac20f825ca52fae80b889302b92240 Mon Sep 17 00:00:00 2001 From: Joseph Date: Mon, 16 Feb 2026 23:54:01 +0100 Subject: [PATCH] chore: issue template and auto close (#1295) * chore: issue tempalte and auto close * chore: formatting issue --- .github/ISSUE_TEMPLATE/bug_report.yml | 82 +++++++++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 8 +++ .github/workflows/validate-issue.yml | 31 ++++++++++ 3 files changed, 121 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/workflows/validate-issue.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..b8d6359 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,82 @@ +name: Bug Report / Documentation Issue +description: Report an issue with the Next.js Learn course +labels: [] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to report an issue! Please fill out the form below. + + - type: checkboxes + id: checklist + attributes: + label: Before submitting + options: + - label: I have searched existing issues to make sure this isn't a duplicate + required: true + - label: I have completed this chapter and encountered the issue myself + required: true + + - type: input + id: chapter_url + attributes: + label: Chapter URL + description: Paste the URL of the chapter where you encountered the issue + placeholder: 'https://nextjs.org/learn/...' + validations: + required: true + + - type: dropdown + id: issue_type + attributes: + label: Issue Type + description: What kind of issue is this? + options: + - Typo or grammatical error + - Outdated code or instructions + - Build or runtime error + - Unclear or confusing instructions + - Missing information + - Other + validations: + required: true + + - type: textarea + id: description + attributes: + label: Description + description: Describe the issue clearly + placeholder: "What's wrong? Be specific about what you found." + validations: + required: true + + - type: textarea + id: expected_vs_actual + attributes: + label: Expected vs Actual Behavior + description: What did you expect to happen, and what actually happened? + placeholder: | + Expected: The code should compile without errors + Actual: I get a TypeScript error on line 42 + validations: + required: true + + - type: textarea + id: environment + attributes: + label: Environment (optional) + description: Your setup details if relevant + placeholder: | + - Node version: + - OS: + - Browser: + validations: + required: false + + - type: textarea + id: screenshots + attributes: + label: Screenshots (optional) + description: Add screenshots if they help explain the issue + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..6c1bf0a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Next.js Documentation + url: https://nextjs.org/docs + about: For general Next.js questions, check the official documentation + - name: GitHub Discussions + url: https://github.com/vercel/next.js/discussions + about: For general discussions about Next.js diff --git a/.github/workflows/validate-issue.yml b/.github/workflows/validate-issue.yml new file mode 100644 index 0000000..d42334c --- /dev/null +++ b/.github/workflows/validate-issue.yml @@ -0,0 +1,31 @@ +name: Validate Issue +on: + issues: + types: [opened] + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Check chapter URL + uses: actions/github-script@v7 + with: + script: | + const body = context.payload.issue.body || ''; + const hasValidUrl = body.includes('nextjs.org/learn'); + + if (!hasValidUrl) { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: 'This issue was automatically closed because it doesn\'t reference a valid nextjs.org/learn URL.' + }); + await github.rest.issues.update({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + state: 'closed', + state_reason: 'not_planned' + }); + }