Skip to content

Commit

Permalink
Merge pull request #5 from tpiperatgod/add_bots
Browse files Browse the repository at this point in the history
add auto_assign and assign bot
  • Loading branch information
tpiperatgod authored Jul 12, 2023
2 parents 4c57790 + 82d8bbd commit ef70bea
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
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;
}

0 comments on commit ef70bea

Please sign in to comment.