forked from JhaSourav07/commitpulse
-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (103 loc) · 5.34 KB
/
Copy pathassign-request-reminder.yml
File metadata and controls
113 lines (103 loc) · 5.34 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Assign Request Reminder
on:
issue_comment:
types: [created]
concurrency:
group: assign-reminder-${{ github.event.issue.number }}-${{ github.event.comment.id }}
cancel-in-progress: false
permissions:
issues: write
contents: read
jobs:
remind-claim:
name: Remind About /claim Command
runs-on: ubuntu-latest
if: >-
!github.event.issue.pull_request &&
github.event.comment.user.type != 'Bot' &&
!contains(github.event.comment.body, '/claim') &&
!contains(github.event.comment.body, '/assign') &&
!contains(github.event.comment.body, '/unassign') &&
!contains(github.event.comment.body, '/addlabel') &&
!contains(github.event.comment.body, '/ping') &&
(
contains(github.event.comment.body, 'assign this issue to me') ||
contains(github.event.comment.body, 'assign this to me') ||
contains(github.event.comment.body, 'please assign me') ||
contains(github.event.comment.body, 'can i work on this') ||
contains(github.event.comment.body, 'can i take this') ||
contains(github.event.comment.body, 'i would like to work on this') ||
contains(github.event.comment.body, 'i want to work on this') ||
contains(github.event.comment.body, 'i''d like to work on this') ||
contains(github.event.comment.body, 'id like to work on this') ||
contains(github.event.comment.body, 'i want to take this issue') ||
contains(github.event.comment.body, 'i want to fix this') ||
contains(github.event.comment.body, 'i want to contribute') ||
contains(github.event.comment.body, 'let me work on this') ||
contains(github.event.comment.body, 'let me take this') ||
contains(github.event.comment.body, 'can i be assigned') ||
contains(github.event.comment.body, 'assign me to this') ||
contains(github.event.comment.body, 'assign me this') ||
contains(github.event.comment.body, 'work on this') ||
contains(github.event.comment.body, 'i''ll work on this') ||
contains(github.event.comment.body, 'ill work on this') ||
contains(github.event.comment.body, 'i can work on this') ||
contains(github.event.comment.body, 'i am interested in this') ||
contains(github.event.comment.body, 'assign') ||
contains(github.event.comment.body, 'i''m interested in this')
)
steps:
- name: Post /claim Reminder
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const commenter = context.payload.comment.user.login;
const issueAuthor = context.payload.issue.user.login;
const { owner, repo } = context.repo;
const issueNumber = context.payload.issue.number;
// Check if the issue is closed — no point reminding on closed issues.
if (context.payload.issue.state === 'closed') return;
// Check if commenter is already assigned — no point reminding them.
const assignees = context.payload.issue.assignees.map(a => a.login.toLowerCase());
if (assignees.includes(commenter.toLowerCase())) return;
const isOpenForAnyone = issueAuthor.toLowerCase() === 'jhasourav07';
const isAuthor = commenter.toLowerCase() === issueAuthor.toLowerCase();
let claimEligibilityNote = '';
if (!isOpenForAnyone && !isAuthor) {
claimEligibilityNote = `\n> ⚠️ **Note:** Only the issue author (@${issueAuthor}) can \`/claim\` this issue. If you'd like to contribute, consider opening a new issue for a bug or feature you've found, then claim that one!`;
}
const bodyLines = [
`👋 Hey @${commenter}! Looks like you want to work on this issue — awesome! 🎉`,
``,
`We don't assign issues through comments like this. Here's how our system works:`,
``,
`## 🤖 How to Claim an Issue`,
``,
`Comment \`/claim\` on this issue and our bot will automatically assign it to you (if you're eligible).`,
``,
`\`\`\``,
`/claim`,
`\`\`\``,
claimEligibilityNote,
``,
`## 📋 A Few Things to Know`,
``,
`- You can hold a **maximum of 3 open issues** at a time.`,
`- If there's **no activity for 3 days**, the assignment will automatically expire so others can pick it up.`,
`- Make sure to read our **[CONTRIBUTING.md](https://github.com/${owner}/${repo}/blob/main/CONTRIBUTING.md)** before you start — it covers code style, commit conventions, and the PR checklist.`,
``,
`## 💬 Join Our Discord`,
``,
`Get faster help, collaborate with other contributors, and stay updated with project news:`,
``,
`[](https://discord.gg/Cb73bS79j)`,
``,
`Happy contributing! 🚀`,
];
await github.rest.issues.createComment({
owner,
repo,
issue_number: issueNumber,
body: bodyLines.join('\n'),
});