mirror of
https://github.com/vercel/next-learn.git
synced 2026-06-11 09:51:47 +00:00
32 lines
998 B
YAML
32 lines
998 B
YAML
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'
|
|
});
|
|
}
|