-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NO-ISSUE Assign reviewers automatically
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'], | ||
}); | ||
} |