chore: issue template and auto close (#1295)

* chore: issue tempalte and auto close

* chore: formatting issue
This commit is contained in:
Joseph
2026-02-16 23:54:01 +01:00
committed by GitHub
parent c57ef7bd8a
commit 914a33426a
3 changed files with 121 additions and 0 deletions

31
.github/workflows/validate-issue.yml vendored Normal file
View File

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