mirror of
https://github.com/bluenviron/mediamtx.git
synced 2026-01-20 02:19:48 -08:00
do not post comments when locking pull requests (#1799)
This commit is contained in:
parent
71310c5eb0
commit
8a264d9fa2
2 changed files with 11 additions and 9 deletions
51
.github/workflows/issues.yml
vendored
51
.github/workflows/issues.yml
vendored
|
|
@ -1,51 +0,0 @@
|
|||
name: issues
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
issues:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- run: npm install mdjson
|
||||
|
||||
- uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const fs = require('fs').promises;
|
||||
const mdjson = require('mdjson');
|
||||
|
||||
const titles = Object.keys(mdjson(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 = Object.keys(mdjson(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',
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue