golanggohlsrtmpwebrtcmedia-serverobs-studiortcprtmp-proxyrtmp-serverrtprtsprtsp-proxyrtsp-relayrtsp-serversrtstreamingwebrtc-proxy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.5 KiB
52 lines
1.5 KiB
name: issue_lint |
|
|
|
on: |
|
issues: |
|
types: [opened] |
|
|
|
jobs: |
|
issue_lint: |
|
runs-on: ubuntu-latest |
|
|
|
steps: |
|
- uses: actions/checkout@v3 |
|
|
|
- uses: actions/github-script@v6 |
|
with: |
|
github-token: ${{ secrets.GITHUB_TOKEN }} |
|
script: | |
|
const fs = require('fs').promises; |
|
|
|
const getTitles = (str) => ( |
|
[...str.matchAll(/^## (.*)/gm)].map((m) => m[0]) |
|
); |
|
|
|
const titles = getTitles(context.payload.issue.body); |
|
|
|
for (let file of await fs.readdir('.github/ISSUE_TEMPLATE')) { |
|
if (!file.endsWith('.md')) { |
|
continue; |
|
} |
|
|
|
const template = await fs.readFile(`.github/ISSUE_TEMPLATE/${file}`, 'utf-8'); |
|
const templateTitles = getTitles(template); |
|
|
|
if (templateTitles.every((title) => titles.includes(title))) { |
|
process.exit(0); |
|
} |
|
} |
|
|
|
await github.rest.issues.createComment({ |
|
owner: context.issue.owner, |
|
repo: context.issue.repo, |
|
issue_number: context.issue.number, |
|
body: 'This issue is being automatically closed because it does not follow the issue template.\n' |
|
+ 'Please reopen the issue and make sure to include all sections of the template.', |
|
}); |
|
|
|
await github.rest.issues.update({ |
|
owner: context.issue.owner, |
|
repo: context.issue.repo, |
|
issue_number: context.issue.number, |
|
state: 'closed', |
|
});
|
|
|