Skip to content

add auto_assign and assign bot #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/auto_assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Set to true to add reviewers to pull requests
addReviewers: true

# Set to author to set pr creator as assignee
addAssignees: author

# A list of reviewers to be added to pull requests (GitHub user name)
reviewers:
- benjaminhuo
- kehuili
- tpiperatgod

# A list of keywords to be skipped the process that add reviewers if pull requests include it
skipKeywords:
- wip

# A number of reviewers added to the pull request
# Set 0 to add all the reviewers (default: 0)
numberOfReviewers: 1

# A list of users to be skipped by both the add reviewers and add assignees processes
skipUsers:
- dependabot[bot]
32 changes: 32 additions & 0 deletions .github/workflows/assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Assign issue

on:
issue_comment:
types: [created]

jobs:
assignbot:
runs-on: ubuntu-latest
steps:
- name: Assign issue
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const payload = context.payload;
const issue = context.issue;
const isFromPulls = !!payload.issue.pull_request;
const commentBody = payload.comment.body;

if (!isFromPulls && commentBody && commentBody.indexOf("/assign") == 0) {
if (!issue.assignees || issue.assignees.length === 0) {
await github.rest.issues.addAssignees({
owner: issue.owner,
repo: issue.repo,
issue_number: issue.number,
assignees: [context.actor],
})
}

return;
}