diff --git a/.github/auto_assign.yml b/.github/auto_assign.yml new file mode 100644 index 00000000..8475e921 --- /dev/null +++ b/.github/auto_assign.yml @@ -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] diff --git a/.github/workflows/assign.yml b/.github/workflows/assign.yml new file mode 100644 index 00000000..4e878b5d --- /dev/null +++ b/.github/workflows/assign.yml @@ -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; + }