-
Notifications
You must be signed in to change notification settings - Fork 40
30 lines (28 loc) · 1.07 KB
/
issue_check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
name: Issue Checker
on:
issues:
types: [opened]
jobs:
check-issue:
runs-on: ubuntu-latest
steps:
- name: Check for Required Information
uses: actions/github-script@v4
with:
script: |
const { issue } = context.payload;
const requiredFields = ['Description', 'Steps to Reproduce', 'Expected Behavior', 'Actual Behavior', 'Environment', 'IDE'];
let missingFields = requiredFields.filter(field => !issue.body.includes(`### ${field}`));
if (missingFields.length > 0) {
const commentBody = `The following fields are missing: ${missingFields.join(', ')}. Please update the issue with this information.`;
await github.issues.createComment({
...context.repo,
issue_number: issue.number,
body: commentBody
});
await github.issues.addLabels({
...context.repo,
issue_number: issue.number,
labels: ['lacking information']
});
}