Files
next-learn/.github/workflows/validate-issue.yml
dependabot[bot] 9668c2530f Bump actions/github-script from 7 to 8
Bumps [actions/github-script](https://github.com/actions/github-script) from 7 to 8.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v7...v8)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-16 23:43:18 +00:00

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