diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84dbedc6..619ce8af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,60 +39,45 @@ jobs: run: | echo "PR Author: ${{ steps.pr_author.outputs.author }}" - - name: Select First Reviewer - id: select_first_reviewer - if: github.actor != steps.pr_author.outputs.author # Exclude the author + - name: Assign Reviewers + id: assign_reviewers run: | author="${{ steps.pr_author.outputs.author }}" - all_users=("stardustmeg" "Kleostro" "YulikK") - - # Exclude the PR author from the list of potential reviewers - potential_reviewers=() - for user in "${all_users[@]}"; do - if [[ "$user" != "$author" ]]; then - potential_reviewers+=("$user") - fi - done - - echo "Potential Reviewers: ${potential_reviewers[@]}" - - if [[ ${#potential_reviewers[@]} -gt 0 ]]; then - # Select the first reviewer from the potential reviewers list - first_reviewer="${potential_reviewers[0]}" - echo "::set-output name=first_reviewer::${first_reviewer}" + if [[ "$author" == "stardustmeg" ]]; then + first_reviewer="Kleostro" + second_reviewer="YulikK" + elif [[ "$author" == "Kleostro" ]]; then + first_reviewer="stardustmeg" + second_reviewer="YulikK" + elif [[ "$author" == "YulikK" ]]; then + first_reviewer="stardustmeg" + second_reviewer="Kleostro" else - echo "No potential reviewers found." + echo "Author not found." + exit 1 fi + echo "::set-output name=first_reviewer::${first_reviewer}" + echo "::set-output name=second_reviewer::${second_reviewer}" - - name: Debug First Reviewer + - name: Debug Reviewers run: | - echo "First Reviewer: ${{ steps.select_first_reviewer.outputs.first_reviewer }}" + echo "First Reviewer: ${{ steps.assign_reviewers.outputs.first_reviewer }}" + echo "Second Reviewer: ${{ steps.assign_reviewers.outputs.second_reviewer }}" - - name: Select Second Reviewer - id: select_second_reviewer + - name: Request First Reviewer if: github.actor != steps.pr_author.outputs.author # Exclude the author - run: | - author="${{ steps.pr_author.outputs.author }}" - all_users=("stardustmeg" "Kleostro" "YulikK") - - # Exclude the PR author and the first reviewer from the list of potential reviewers - potential_reviewers=() - for user in "${all_users[@]}"; do - if [[ "$user" != "$author" && "$user" != "${{ steps.select_first_reviewer.outputs.first_reviewer }}" ]]; then - potential_reviewers+=("$user") - fi - done - - echo "Potential Reviewers: ${potential_reviewers[@]}" - - if [[ ${#potential_reviewers[@]} -gt 0 ]]; then - # Select the second reviewer from the potential reviewers list - second_reviewer="${potential_reviewers[0]}" - echo "::set-output name=second_reviewer::${second_reviewer}" - else - echo "No potential reviewers found." - fi + uses: octokit/request-action@v2.x + with: + route: POST /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers + mediaType: '{"previews":["luke-cage"]}' + token: ${{ secrets.GITHUB_TOKEN }} + reviewers: ${{ steps.assign_reviewers.outputs.first_reviewer }} - - name: Debug Second Reviewer - run: | - echo "Second Reviewer: ${{ steps.select_second_reviewer.outputs.second_reviewer }}" + - name: Request Second Reviewer + if: github.actor != steps.pr_author.outputs.author # Exclude the author + uses: octokit/request-action@v2.x + with: + route: POST /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers + mediaType: '{"previews":["luke-cage"]}' + token: ${{ secrets.GITHUB_TOKEN }} + reviewers: ${{ steps.assign_reviewers.outputs.second_reviewer }}