Skip to content

Commit

Permalink
update auto assign workflow (#28387)
Browse files Browse the repository at this point in the history
* update auto assign workflow

* update rest call and workflow name

* move permission block
  • Loading branch information
katbyte authored Dec 26, 2024
1 parent cde02da commit 5480e67
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions .github/workflows/auto-assign-reviewers-to-pr.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
name: Auto Assign Reviewers as Assignees
name: Assign Reviewer as Assignee

on:
pull_request:
pull_request_review:
types:
- review_requested
- review_request_removed
- reopened
- edited
- synchronize
- submitted

jobs:
auto_assign_reviewers:
assign_reviewer:
runs-on: ubuntu-latest

permissions:
issues: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Get reviewers and assign them
uses: peter-evans/review-assign-action@v1
- name: Assign the reviewer as assignee
uses: actions/github-script@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
reviewers: reviewers
assignees: reviewers
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const reviewer = context.payload.review.user.login;
const prNumber = context.payload.pull_request.number;
console.log(`Assigning reviewer: ${reviewer} to PR #${prNumber}`);
await github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
assignees: [reviewer],
});

0 comments on commit 5480e67

Please sign in to comment.