Skip to content

Commit

Permalink
Request a review from oss team members when mlflow-team is requested …
Browse files Browse the repository at this point in the history
…a review (#10928)

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
  • Loading branch information
harupy committed Jan 29, 2024
1 parent 065f543 commit 65c6b8c
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/team-review.yml
@@ -0,0 +1,48 @@
name: Team review

on:
pull_request_target:
types: [review_requested]

jobs:
review:
runs-on: ubuntu-latest
if: ${{ github.event.requested_team.name == 'mlflow-team'}}
steps:
- uses: actions/checkout@v4
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.MLFLOW_AUTOMATION_TOKEN }}
script: |
const { owner, repo } = context.repo;
const pull_number = context.payload.pull_request.number;
const members = [
"B-Step62",
"BenWilson2",
"daniellok-db",
"harupy",
"serena-ruan",
"WeichenXu123",
];
const author = context.payload.pull_request.user.login;
const reviews = await github.rest.pulls.listReviews({
owner,
repo,
pull_number,
});
const approved = reviews.data
.filter((r) => r.state === "APPROVED")
.map((r) => r.user.login);
await github.rest.pulls.requestReviewers({
owner,
repo,
pull_number,
reviewers: members.filter((m) => !approved.includes(m) && m !== author),
});
await github.rest.pulls.removeRequestedReviewers({
owner,
repo,
pull_number,
reviewers: [],
team_reviewers: ["mlflow-team"]
});

0 comments on commit 65c6b8c

Please sign in to comment.