Skip to content

Commit

Permalink
NO-ISSUE Assign reviewers automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
Yang-33 committed Dec 19, 2024
1 parent 78baa65 commit 968d869
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/assign-reviewer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Assign Reviewers
on:
pull_request:
types: [opened, ready_for_review]

jobs:
assign_reviewers:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
# Although you could use CodeOwners, we do not want to review Pull Requests created by Renovate or Dependabot.
# We do want to review PRs created by other bots (e.g., GitHub Actions) or regular users.
# Also, reviewers should only be assigned if the PR is not a draft.
- name: Assign reviewers for non-draft PRs that are not from Renovate or Dependabot
uses: actions/github-script@v6
with:
script: |
const pr = context.payload.pull_request;
const excludedBotAuthors = ['renovate[bot]', 'dependabot[bot]'];
if (!excludedBotAuthors.includes(pr.user.login) && !pr.draft) {
await github.rest.pulls.requestReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number,
team_reviewers: ['line/bot-sdk-general-reviewers'],
});
}

0 comments on commit 968d869

Please sign in to comment.