-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (43 loc) · 1.75 KB
/
auto-notifier.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Auto Reply to Article Submission
on:
issues:
types:
- opened
- labeled
jobs:
check-labels-and-comment:
runs-on: ubuntu-latest
steps:
- name: Check if the issue has the required labels
id: label-check
uses: actions/github-script@v6
with:
script: |
const requiredLabels = ['article', 'submission'];
const issueLabels = context.payload.issue.labels.map(label => label.name);
const hasAllLabels = requiredLabels.every(label => issueLabels.includes(label));
return hasAllLabels;
result-encoding: string
- name: Add comment to the issue
if: steps.label-check.outputs.result == 'true'
uses: actions/github-script@v6
with:
script: |
const issueCreator = context.payload.issue.user.login;
const comment = `Hi @${issueCreator},\n\nThanks for submitting your article! We will review it within 7 days.\n\nPlease ensure the following:\n- [ ] Your submission aligns with our goals and mission.\n- [ ] It does not market you or your company.\n\nWe will get back to you after our review!`;
await github.issues.createComment({
...context.repo,
issue_number: context.payload.issue.number,
body: comment
});
- name: Assign the issue to the creator
if: steps.label-check.outputs.result == 'true'
uses: actions/github-script@v6
with:
script: |
const issueCreator = context.payload.issue.user.login;
await github.issues.addAssignees({
...context.repo,
issue_number: context.payload.issue.number,
assignees: [issueCreator]
});