mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-01-10 03:08:57 +08:00
bb8703520a
chore(issue_template): add a comment for clarity to bug_report
39 lines
1.4 KiB
YAML
39 lines
1.4 KiB
YAML
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'
|
|
})
|
|
}
|