Skip to content

Commit ef70bea

Browse files
authored
Merge pull request #5 from tpiperatgod/add_bots
add auto_assign and assign bot
2 parents 4c57790 + 82d8bbd commit ef70bea

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

.github/auto_assign.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Set to true to add reviewers to pull requests
2+
addReviewers: true
3+
4+
# Set to author to set pr creator as assignee
5+
addAssignees: author
6+
7+
# A list of reviewers to be added to pull requests (GitHub user name)
8+
reviewers:
9+
- benjaminhuo
10+
- kehuili
11+
- tpiperatgod
12+
13+
# A list of keywords to be skipped the process that add reviewers if pull requests include it
14+
skipKeywords:
15+
- wip
16+
17+
# A number of reviewers added to the pull request
18+
# Set 0 to add all the reviewers (default: 0)
19+
numberOfReviewers: 1
20+
21+
# A list of users to be skipped by both the add reviewers and add assignees processes
22+
skipUsers:
23+
- dependabot[bot]

.github/workflows/assign.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Assign issue
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
jobs:
8+
assignbot:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Assign issue
12+
uses: actions/github-script@v6
13+
with:
14+
github-token: ${{ secrets.GITHUB_TOKEN }}
15+
script: |
16+
const payload = context.payload;
17+
const issue = context.issue;
18+
const isFromPulls = !!payload.issue.pull_request;
19+
const commentBody = payload.comment.body;
20+
21+
if (!isFromPulls && commentBody && commentBody.indexOf("/assign") == 0) {
22+
if (!issue.assignees || issue.assignees.length === 0) {
23+
await github.rest.issues.addAssignees({
24+
owner: issue.owner,
25+
repo: issue.repo,
26+
issue_number: issue.number,
27+
assignees: [context.actor],
28+
})
29+
}
30+
31+
return;
32+
}

0 commit comments

Comments
 (0)