Skip to content

Commit

Permalink
Add github action to auto assign reviewers when creating pull request…
Browse files Browse the repository at this point in the history
… for iOS
  • Loading branch information
shin-usu committed Aug 14, 2024
1 parent 5be67aa commit 23ba728
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/ios-assign-reviewers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Auto assign iOS PR reviewers

on:
pull_request:
types: [opened, ready_for_review, labeled]

jobs:
reviewers-assign:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write

timeout-minutes: 5
steps:
- name: Assign reviewers
uses: actions/github-script@v7
if: contains(github.event.pull_request.labels.*.name, 'type:iOS 🍎') && github.event.pull_request.draft == false
env:
IOS_REVIEWERS: ${{ vars.IOS_REVIEWERS }}
with:
script: |
const { IOS_REVIEWERS } = process.env
const author = context.payload.pull_request.user.login;
const reviewers = IOS_REVIEWERS.split(',')
const filteredReviewers = reviewers.filter(reviewer => reviewer !== author)
await github.rest.pulls.requestReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
filteredReviewers
});

0 comments on commit 23ba728

Please sign in to comment.