-
-
Notifications
You must be signed in to change notification settings - Fork 116
42 lines (39 loc) · 1.28 KB
/
auto-assign.yaml
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
name: Auto-assign issue on /attempt comment
on:
issue_comment:
types: [created]
jobs:
auto-assign:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const comment = context.payload.comment;
const issue = context.issue;
const owner = "keyshade-xyz";
const repo = "keyshade"
if (comment.body.startsWith('/attempt')) {
if (!issue.assignee) {
await github.rest.issues.addAssignees({
owner,
repo,
issue_number: issue.number,
assignees: [comment.user.login]
});
await github.rest.issues.createComment({
owner,
repo,
issue_number: issue.number,
body: 'Assigned the issue to you!'
});
} else {
await github.rest.issues.createComment({
owner,
repo,
issue_number: issue.number,
body: 'This issue is already assigned. Tag a maintainer if you need to take over.'
});
}
}