From 23ba728a04b45c8b627f97086187ee171c77e8ee Mon Sep 17 00:00:00 2001 From: vixer93 Date: Wed, 14 Aug 2024 14:49:55 +0900 Subject: [PATCH] Add github action to auto assign reviewers when creating pull request for iOS --- .github/workflows/ios-assign-reviewers.yml | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/ios-assign-reviewers.yml diff --git a/.github/workflows/ios-assign-reviewers.yml b/.github/workflows/ios-assign-reviewers.yml new file mode 100644 index 000000000..24de4a446 --- /dev/null +++ b/.github/workflows/ios-assign-reviewers.yml @@ -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 + });