mirror of
https://github.com/vercel/next-learn.git
synced 2026-06-28 07:04:28 +00:00
chore: issue template and auto close (#1295)
* chore: issue tempalte and auto close * chore: formatting issue
This commit is contained in:
31
.github/workflows/validate-issue.yml
vendored
Normal file
31
.github/workflows/validate-issue.yml
vendored
Normal 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'
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user