feat: switch to issue forms (#297)

and remove autocloser as form fields can be/are required
This commit is contained in:
GeopJr
2022-06-29 19:36:03 +03:00
committed by GitHub
parent 37721ce73f
commit 8df7c27d5f
5 changed files with 102 additions and 96 deletions

View File

@ -1,38 +0,0 @@
name: Autocloser
on:
issues:
types: [opened]
jobs:
autoclose:
runs-on: ubuntu-latest
name: Autocloser
steps:
- name: Autoclose issue that does not follow template
uses: actions/github-script@v6
env:
message: "this issue was automatically closed because it did not follow the issue template.\n\nA moderator will reopen the issue if it is valid, otherwise it will be tagged with \"invalid\" afterwards."
pattern: "(.*Describe the bug.*To Reproduce.*Expected behavior.*Logs.*Build.*)|(.*Is your feature request related to a problem. Please describe..*Describe the solution you'd like.*Provide Reasoning.*)"
with:
script: |
const { message, pattern } = process.env
if (!context.payload.sender) return;
const body = context.payload.issue.body;
const templateRegex = new RegExp(pattern, "s")
if (!body || !body.match(templateRegex)) {
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `@${context.payload.sender.login}, ${message}`
})
github.rest.issues.update({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
state: 'closed'
})
}