devops: auto close questions (#29513)

Signed-off-by: Max Schmitt <max@schmitt.mx>
This commit is contained in:
Max Schmitt 2024-02-15 18:14:51 +01:00 committed by GitHub
parent b11b118e02
commit 09d0a099a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,26 @@
name: Close Issue on Specific Text
on:
issues:
types: [opened]
permissions:
issues: write
jobs:
close_issue_if_forbidden_text_found:
runs-on: ubuntu-latest
steps:
- name: Close issue with specific text
uses: actions/github-script@v7
with:
script: |
const issueBody = context.payload.issue.body;
if (!issueBody.includes('Please do not submit this issue.') || !issueBody.includes('This issue tracker is reserved for bug reports and feature requests.'))
return;
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
state: 'closed'
});